[Patch] Efficient ByteVector::replace() implementation

Wladimir Palant palant at songbirdnest.com
Thu Sep 17 08:34:11 CEST 2009


Hello,

I noticed that TagLib will perform exceptionally badly on some 
occasions. One extreme example that I've been looking at was an MP3 file 
with an album image in BMP format - 7 MB. Extracting that image via 
TagLib took definitely more than 10 minutes, I didn't have the patience 
to wait for it to be done. All the time was being spent in 
ByteVector::replace() method which performs poorly. Here is a patch for 
that method: 
http://bugzilla.songbirdnest.com/attachment.cgi?id=12077&action=diff 
(http://bugzilla.songbirdnest.com/attachment.cgi?id=12077&action=diff&format=raw 
for the raw patch). The new algorithm never resizes the vector more than 
once, it also doesn't perform any unnecessary move operations. The file 
in question is processed in less than a second.

regards
Wladimir

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 6789 bytes
Desc: S/MIME Cryptographic Signature
Url : http://mail.kde.org/pipermail/taglib-devel/attachments/20090917/50f59048/attachment.p7s 


More information about the taglib-devel mailing list