Bug 8112 - ~7% speedup for pdf loading by removing memory copies
Summary: ~7% speedup for pdf loading by removing memory copies
Status: RESOLVED FIXED
Alias: None
Product: poppler
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
Hardware: x86 (IA32) Windows (All)
: high normal
Assignee: poppler-bugs
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-09-02 17:14 UTC by Krzysztof Kowalczyk
Modified: 2006-09-03 02:27 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
Patch as described in the bug (5.26 KB, patch)
2006-09-02 17:14 UTC, Krzysztof Kowalczyk
Details | Splinter Review

Description Krzysztof Kowalczyk 2006-09-02 17:14:12 UTC
Currently during Parser::getObj() and when adding values to dictionaries poppler
makes unnecessary copies of objects. When objects are strings, this means
reallocating memory. Since Parser::getObj() is called (literally) in N*100k
times, those memory allocations contribute significantly to the execution time
(e.g. delete is 4th most expensive function).

The attached patch makes really only two small changes:
a) avoid memory copy by giving the caller an ownership of the object and nulling
the object in one code path
b) optimizing UGooString usage of key variable (it was always constructed but is
not always needed)

Also adds helper Dict::add* functions to make b) (and maybe other future changes
like that) possible.
Comment 1 Krzysztof Kowalczyk 2006-09-02 17:14:29 UTC
Created attachment 6797 [details] [review]
Patch as described in the bug
Comment 2 Krzysztof Kowalczyk 2006-09-02 17:15:35 UTC
Forgot to mention that this patch gives me a consistent ~7% speedup for PDF
loading stage.
Comment 3 Albert Astals Cid 2006-09-03 02:27:53 UTC
Commited, thanks, i got a 10% speed increase on the pdf i tested but i guess 
that is because i don't have the other optimizations so this one gave me more 
boost to me than to you.


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.