Allocation (malloc()/free() calls) account for a lot of time used by poppler. Custom memory allocator uses free lists and allocates memory in chunks for the most frequently allocated memory sizes (in my testing about 90% of allocations are served by the 4 sizes covered by the patch). The code is optional and only used when USE_FAST_ALLOC symbol is defined so it can be easily turned on and off. In my testing with this patch loading ~8MB pdf file (PDFReference1.6.pdf available from Adobe website)is speed up by ~25% (this is on top of my previous optimizations; improvement should be even better against current poppler CVS sources). Code is copiously commented and the algorithm used rahter simple.
Created attachment 6590 [details] [review] custom memory allocator
A custom memory allocator is something i don't want to use, there's much more lower hanging fruit out there than a custom memory allocator.
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.