-
Notifications
You must be signed in to change notification settings - Fork 10.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Faster JBIG2 decoding for Firefox #3542
Conversation
/botio test |
From: Bot.io (Windows)ReceivedCommand cmd_test from @Snuffleupagus received. Current queue size: 0 Live output at: http://107.22.172.223:8877/9296ad355478fb9/output.txt |
From: Bot.io (Windows)FailedFull output at http://107.22.172.223:8877/9296ad355478fb9/output.txt Total script time: 21.74 mins
Image differences available at: http://107.22.172.223:8877/9296ad355478fb9/reftest-analyzer.xhtml#web=eq.log |
/botio-linux test |
From: Bot.io (Linux)ReceivedCommand cmd_test from @yurydelendik received. Current queue size: 2 Live output at: http://107.21.233.14:8877/7c1620962e5048c/output.txt |
From: Bot.io (Linux)SuccessFull output at http://107.21.233.14:8877/7c1620962e5048c/output.txt Total script time: 23.65 mins
|
https://bugzilla.mozilla.org/show_bug.cgi?id=893038 might help with the inlining Could you tell which build of Nightly you used for benchmark? |
It should be a recent linux build from 1 or 2 days ago. I would have to check at home to tell you if it was 32 or 64 bits, if that was your question.
Thank you, I'll have a look at that. |
How come the windows test failed? |
That's an intermittent failure that's been around for some time, so you can safely ignore this. |
@Snuffleupagus Could you generate a preview for this PR? I'd like to test it. :) |
/botio-windows preview |
From: Bot.io (Windows)ReceivedCommand cmd_preview from @Snuffleupagus received. Current queue size: 0 Live output at: http://107.22.172.223:8877/68ae65f146b5cc6/output.txt |
From: Bot.io (Windows)SuccessFull output at http://107.22.172.223:8877/68ae65f146b5cc6/output.txt Total script time: 0.31 mins Published |
It's indeed faster. On Windows 7 x64, Firefox 22 and PDF.js 0.8.396, the loading time for the PDF in #2909 went down from approx. 19 seconds for the first two pages to approx. 14 seconds for the first two pages. The PDF in #3448 also appears to be a bit faster, but it was already very fast (approx. 1 second) for me, so hard to say. Definitely a great optimization here :) |
28% faster for me for lastest Nigthly. Thanks |
Faster JBIG2 decoding for Firefox
JPX is using the same decoder, could you look if your optimization will do the magic there as well? |
I guess it would work, but I think that the arithmetic coder is not the bottleneck there. At least not in the examples of #3181, #2790, and #268 (http://simonster.com/S2.pdf). |
Yeah, but 28% improvement is a good improvement if we can get it on JPX decoding. See also a discussion at https://bugzilla.mozilla.org/show_bug.cgi?id=847389 for other JPX bottlenecks. One of them index variable "type", "casting" it to int (e.g. a[i >> 0] v.s. a[i]) might improve the performance a little. |
@yurydelendik As your references to Bugzilla suggest, Firefox does seem to have a problem with inlining/not inlining methods. I was optimizing some code for the jpx decoder in various ways, but surprisingly, the only thing that really helped was extracting some often-called code to its own method, see #3554. Was something preventing the compilers from doing their work? |
No it does not work here, its slower. I just tried. |
I really appreciate you looking into this. I was talking to js engine guy. Many things can go wrong and prevent compiler doing inlining. In the past I used https://addons.mozilla.org/en-US/firefox/addon/jit-inspector/?src=api to check what's going on with ion compiler. Thanks to checking those stuff for us. |
This PR improves decoding speed of JBIG2 (scanned black & white) images on Firefox, and so improves #2909 and #3448.
Speed was increased via
The rendering speed on Firefox 24a2 is increased by factor 1.5x-5x, and by 1.5x in FF25. Chrome28 speed is unaffected.
The timings seem to be a little inconsistent though (maybe because they are measured in a VirtualBox VM?). On Windows, decoding times decreased by factor 1.25 on FF22, and by factor 2 on FF25 nightly.
Can somebody confirm the speedup?
Firefox 24a2:
Firefox nightly 25a1:
Chrome 28: