[Poppler-bugs] [Bug 8143] ~4% speedup on loading PDF through Lexer/Stream improvements

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Sat Dec 6 17:45:09 PST 2008


http://bugs.freedesktop.org/show_bug.cgi?id=8143





--- Comment #2 from Ludovic Aubry <ludovic.aubry at logilab.fr>  2008-12-06 17:45:07 PST ---
a better approach would be to make getChar an inline function of Stream with :

int getChar() { return (bufPtr >= bufEnd && !fillBuf()) ? EOF : (*bufPtr++ &
0xff); }

(which is what FileStream does, but cannot be inlined as the method is virtual)

Once all classes use this single *inlined* implementation it's easy to
replace all existing getChar either with an efficient fillBuf or if it's not
possible with a fillBuf method that fills a one char buffer (with the existing
getChar implementation). Each derived class is free to implement the buffer it
needs.

I started a patch along these lines a long time ago against xpdf 1.01 and lost
interest when 2.0 got out before I could submit a final version. There are
probably some parts worth recovering if there is any interests.

I didn't keep the benchmarks but I recall the improvement was quite nice with
pdftotext.


-- 
Configure bugmail: http://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


More information about the Poppler-bugs mailing list