Bug 8352

Summary: Un-virtual-ize Stream::getRawChar() for 35-45% speed boost for some pages
Product: poppler Reporter: Krzysztof Kowalczyk <kkowalczyk>
Component: generalAssignee: poppler-bugs <poppler-bugs>
Status: RESOLVED INVALID QA Contact:
Severity: normal    
Priority: high    
Version: unspecified   
Hardware: x86 (IA32)   
OS: Windows (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: un-virtual-ize getRawChar()

Description Krzysztof Kowalczyk 2006-09-19 01:39:39 UTC
This patch makes Stream::getRawChar() non-virtual (actually it removes it
completely from Stream and makes it into an interface that only streams that use
StreamPredictor use implement. This makes it calling getRawChar() much faster.

Hard to believe it but on my test file that has an image that causes to use
FlateStream with StreamPredictor this small change gives 15-45% in rendering a
page (depends on the page).

There's still room for improvement for example in e.g.

int FlateStream::getChar() {
  if (pred) {
    return pred->getChar();
  } else {
    return getRawChar();
  }
}

doing the if () for every character read will probably accumulate. I think I
came up with the scheme that would implement 2 versions of each stream that
might use StreamPredictor, to eliminate this if (), but that's a bigger change.
Comment 1 Krzysztof Kowalczyk 2006-09-19 01:40:27 UTC
Created attachment 7068 [details] [review]
un-virtual-ize getRawChar()

As described in bug.
Comment 2 Krzysztof Kowalczyk 2006-09-20 14:15:10 UTC
Nevermind, this patch is wrong. It always calls the getRawChar in IGetRawChar,
not in the class I want. Which is why they invented virtual in C++, but I wanted
to get rid of virtual, so this is no good.

More testing next time before I post a patch.
Comment 3 Albert Astals Cid 2006-09-20 14:18:38 UTC
;-)

BTW, did you see you already have the cvs account?

Once krh creates the 0.6 branch you can start commiting all your nice patches 
there!

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.