[Patch] Efficient ByteVector::replace() implementation

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


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: 
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.


-------------- 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