[poppler] Even more speedups

Krzysztof Kowalczyk kkowalczyk at gmail.com
Sun Sep 3 13:26:36 PDT 2006


Hello,

I've made another performance tweak:
https://bugs.freedesktop.org/show_bug.cgi?id=8115

Currently poppler free()s/malloc()s strings a lot. Many of those
re-allocations are done for strings in Object class. I've improved
that by a simple custom allocator that caches N recently free()d
strings and satisfies alloc()s from that cache, avoiding
free()/malloc() cycle. In my tests the cache is very effective: even a
small cache (16 strings) can satisfy >99% of all allocations
requests.

It also changes Object::name and Object::cmd to use GooString *
instead of char *, so that they can benefit from the cache.

It also tweaks GooString and UGooString a bit and fixes a UGooString
bug where re-allocation would only preserve half of the string
(probably introduced by me earlier).

In my tests I get 2-10% speedup on loading PDF, 4% being the most common.

-- kjk
Sumatra (PDF Viewer for Windows):
http://blog.kowalczyk.info/software/sumatrapdf


More information about the poppler mailing list