TagLib::String::null considered harmful

Jeff Mitchell kde-dev at emailgoeshere.com
Fri Mar 7 15:48:13 CET 2008


Peter Hartley wrote:
> TagLib (1.4 and 1.5) is nearly, but not quite, thread-safe, in the sense
> of being able to read the metadata from two different files in two
> different threads at the same time without them interfering. (With a
> multi-core CPU or with good disk queueing, this should be faster than
> the single-threaded solution when scanning a large library.)
>   
Peter, are you sure this would actually be faster?  Disk/network I/O is 
typically the bottleneck, which won't be helped just by multithreading 
(you can see this easily in  e.g. Amarok's collection scanner; if you 
have a small local collection with a good deal of RAM such that all data 
ends up resident in RAM, subsequent full scans are almost instantaneous 
vs. the initial one that is heavily disk I/O bound).  Good disk queuing 
could maybe help, but might not.  If files are stored in more or less 
subsequent blocks on disk, you won't see much or any speed improvement 
by multithreading.  If they aren't multithreading + good disk queueing 
could possibly help, but if the disk queueing isn't really that good, or 
if files are in subsequent blocks on disk, you could end up even worse 
as the disk could end up seeking all over the place trying to satisfy 
the requests of different threads.

At least, that's my understanding of things  :-)

--Jeff


More information about the taglib-devel mailing list