Bug 8115

Summary: ~4% speedup for PDF loading by means of Object string cache
Product: poppler Reporter: Krzysztof Kowalczyk <kkowalczyk>
Component: generalAssignee: poppler-bugs <poppler-bugs>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: high    
Version: unspecified   
Hardware: x86 (IA32)   
OS: Windows (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: Patch as described in the bug
The patch i applied to head as of 28-12-2006

Description Krzysztof Kowalczyk 2006-09-03 13:19:41 UTC
Currently poppler free()s/malloc()s strings a lot. Many of those re-allocations
are done for strings in Object class. Attached patch improves 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.

In my tests I get 2-10% speedup on loading PDF, 4% being the most common.
Comment 1 Krzysztof Kowalczyk 2006-09-03 13:20:02 UTC
Created attachment 6802 [details] [review]
Patch as described in the bug
Comment 2 Albert Astals Cid 2006-12-28 09:08:00 UTC
Applied this patch and got no noticeable improvement here.
Comment 3 Albert Astals Cid 2006-12-28 09:09:16 UTC
Created attachment 8238 [details] [review]
The patch i applied to head as of 28-12-2006
Comment 4 Albert Astals Cid 2006-12-28 09:13:17 UTC
you meantion a "UGooString bug where re-allocation would only preserve half of 
the string." can you point exactly where that lies?
Comment 5 Albert Astals Cid 2010-04-06 14:04:51 UTC
Closed, as far as i remember, this was kind of commited.

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.