[poppler] [PATCH] Custom memory allocator to improve loading time by ~25%

Krzysztof Kowalczyk kkowalczyk at gmail.com
Thu Aug 17 22:42:58 PDT 2006


As I've mentioned previously, memory allocations (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

Code is copiously commented and the algorithm used rather simple.

The good part is that it hooks things at a very low level so no
changes in actual poppler logic was necessary.

This is bug https://bugs.freedesktop.org/show_bug.cgi?id=7910

When combined with my other performance patch
https://bugs.freedesktop.org/show_bug.cgi?id=7808, the loading time of
my test document drops almost in half.

I think I can improve this even further by optmizing Lexer::getChar()

-- kjk | http://blog.kowalczyk.info

More information about the poppler mailing list