Howdy guys. Sorry for the crosspost. Patch to speed up taglib.

Scott Wheeler wheeler at
Sat Oct 6 16:52:15 CEST 2007

Allan Sandfeld Jensen wrote:
> On Friday 05 October 2007 17:32, Manuel Amador (Rudd-O) wrote:
>> Here's a patch.  Hope it's useful.
>> I dunno how to make KMail not linewrap, so I'm attaching it and pasting it
>> as well.
>> This patch implements on posix systems the fadvise system call that makes
>> the system not readahead mp3 while scanning for tags.  It's absurd to
>> introduce readahead to a problem that entails reading two or three 64 K
>> pages at most. Less I/O is good. right?
> Depends. This might speed-up collection scanning, but it would also slow down 
> normal one file scan and play, because you are evicting pages that is going 
> to be reused by the decoder right after tag-reading. Maybe if you remove the 
> last DONTNEED advise, it will be performance-wise safer. 

I also suspect that it will slow down reading since there will be more 
blocking I/O roundtrips.  I don't know if this at a system level is 
implemented as "only cache things a little" or "really grab the bytes 
from the spinning magnetic thing every time".  If it's the latter, for 
this to not suck a lot TagLib would need to do its own internal 
readahead caching.

Right now the I/O calls are built on the assumption that doing one 
little read and then another little read a little later is still fast.

I'm in the process of backup / reinstall / blah on my Linux box, so I'll 
probably get around to testing this in a day or two (and this call isn't 
present on OS X, where I'm typing this).


More information about the taglib-devel mailing list