question and method about taglib performance

Indy Sams indy at
Sat Sep 22 21:42:23 UTC 2012


I haven't done any real benchmarks, but I thought I would contribute an IOStream implementation using mmap on Linux and MapViewOfFile on Windows for peoples' use and testing (attached to email). Usage is at the end of the file and only reading is implemented, not any write functions.

I may have overlooked it, but I didn't see an equivalent of FileRef that accepts an IOStream. I had to create a format-specific File object (eg. TagLib::MPEG::File) instead of being able to use a generic tag interface like FileRef.

P.S. Also noticed in the 1.8 download it still has "#define TAGLIB_MINOR_VERSION 7" in taglib.h instead of "#define TAGLIB_MINOR_VERSION 8"

Wednesday, September 19, 2012, 5:05:10 AM, you wrote:

YWCEC> Hi, Dear,
YWCEC>      We used taglib do mp3 file parsing, the number of parse files we need is very bigger, about 5000. We need to do this task as quick as possible. So we meet a problem about performace. 
YWCEC>      We checked the issue and found that much time was wasted when file fopen and fread. We think this is caused by fileIO. So we used mmap instread of fopen/fread/fwrite when OS is linux, and got the result that the performance was increased about 25%.
YWCEC>       But, as we all know, when using file mmap, the  memory which the process need is equal to the size of file. For example, when the filesize is 1G, the process need 1G memory for file
YWCEC> mmap. This is intolerable. So we add a condition. When filesize is smaller than 10M, we use mmap, others we use fopen which the taglib use now. 
YWCEC>       So, What about the method of using mmap, is it acceptable? We had done this change and passed the tests which taglib provide. 
YWCEC>       Waiting for your news, thanks very much
YWCEC> yaowj

Best regards,
 Indy Sams
 mailto:indy at
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: taglib.mmap.cpp
URL: <>

More information about the taglib-devel mailing list