-
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 JPX decoding #4264
Faster JPX decoding #4264
Conversation
/botio test |
From: Bot.io (Linux)ReceivedCommand cmd_test from @Snuffleupagus received. Current queue size: 0 Live output at: http://107.21.233.14:8877/1a2e69cdc7f0d44/output.txt |
From: Bot.io (Windows)ReceivedCommand cmd_test from @Snuffleupagus received. Current queue size: 0 Live output at: http://107.22.172.223:8877/259980401037aca/output.txt |
From: Bot.io (Linux)FailedFull output at http://107.21.233.14:8877/1a2e69cdc7f0d44/output.txt Total script time: 21.33 mins
Image differences available at: http://107.21.233.14:8877/1a2e69cdc7f0d44/reftest-analyzer.xhtml#web=eq.log |
Since Chrome timed out, let's re-run the test. /botio-linux test |
From: Bot.io (Linux)ReceivedCommand cmd_test from @Snuffleupagus received. Current queue size: 0 Live output at: http://107.21.233.14:8877/bac70aa27711e01/output.txt |
From: Bot.io (Windows)SuccessFull output at http://107.22.172.223:8877/259980401037aca/output.txt Total script time: 38.20 mins
|
From: Bot.io (Linux)SuccessFull output at http://107.21.233.14:8877/bac70aa27711e01/output.txt Total script time: 23.76 mins
|
/botio-linux preview |
From: Bot.io (Linux)ReceivedCommand cmd_preview from @timvandermeij received. Current queue size: 0 Live output at: http://107.21.233.14:8877/a196da3bbb51d1d/output.txt |
From: Bot.io (Linux)SuccessFull output at http://107.21.233.14:8877/a196da3bbb51d1d/output.txt Total script time: 0.23 mins Published
|
@fkaelberer It is indeed loading faster, but I notice the page loading indicators stop spinning when the pages are loading. This isn't the case with the current viewer. Can you reproduce that? |
No... at least not on Firefox / Windows / pdf.js.xpi |
@fkaelberer I see that I should have been more specific, so I'm not sure we were talking about the same issue. I meant that the loading indicator shows up, but doesn't spin when loading pages from the bird book PDF from #2790. The default (Tracemonkey) PDF for example is fine, only PDFs with JPX images seem to be affected. Steps to reproduce for me are:
My configuration: Windows 7 x64, Firefox Nightly 30.0a1 (HWA on, 64 bit) and the viewer from the generated preview above. |
@timvandermeij Following your STR, I'm not able to reproduce that issue. The spinners work fine even with this patch applied. Configuration: Windows 7 (64-bit), Firefox Nightly 30 (buildID: 20140208030207) with HWA on. |
Hm, I cleared the cache again and now it's working. That's strange because I have cache disabled by default, but I'm happy that it's not an issue caused by this patch! |
for (var v = 0; v < height; v++, k += width, l++) | ||
buffer[l] = items[k]; | ||
// if we ran out of buffers, copy several image columns at once | ||
if (currentBuffer === buffersCached) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To improve readability, can you introduce e.g. buffersToProcess
that will be set to buffersCached
, reduced after var buffer = colBuffers[currentBuffer];
and be used detect when to flush or populate the buffer? (As alternative currentBuffer
can be used but in reverse order)
Looks good with the changes above. |
All right, I'll do that in the next few days. |
Ok, there you go. I made |
/botio-linux preview |
From: Bot.io (Linux)ReceivedCommand cmd_preview from @timvandermeij received. Current queue size: 0 Live output at: http://107.21.233.14:8877/df95c2df5e844f8/output.txt |
From: Bot.io (Linux)SuccessFull output at http://107.21.233.14:8877/df95c2df5e844f8/output.txt Total script time: 0.22 mins Published
|
/botio test |
From: Bot.io (Linux)ReceivedCommand cmd_test from @timvandermeij received. Current queue size: 0 Live output at: http://107.21.233.14:8877/40ad25e4b57ae91/output.txt |
From: Bot.io (Windows)ReceivedCommand cmd_test from @timvandermeij received. Current queue size: 0 Live output at: http://107.22.172.223:8877/15a3c3c609fe2db/output.txt |
From: Bot.io (Linux)FailedFull output at http://107.21.233.14:8877/40ad25e4b57ae91/output.txt Total script time: 23.62 mins
Image differences available at: http://107.21.233.14:8877/40ad25e4b57ae91/reftest-analyzer.xhtml#web=eq.log |
From: Bot.io (Windows)SuccessFull output at http://107.22.172.223:8877/15a3c3c609fe2db/output.txt Total script time: 35.24 mins
|
Thank you for the patch. |
This PR reduces decoding time of JPX images by some 10 to 25 percent, and so improves #2790 and #2103 a little bit.
Roughly 50 % of JPX decoding time is spend for (arithmetic) decoding of the byte stream, and the remaining 50 % is (mostly) spend on the wavelet transform. This PR concerns wavelet transform.
During the wavelet transform, rows and columns of the images are processed individually, and the bottleneck is mainly memory copy performance to access rows and cols.
This PR increases memory performance by
Array.set()
when reading rows andUsing different settings, I measured the following timings. Numbers are averaged over the first 4 pages of #2790, but are similar for other JPX-heavy pdfs.
5201ms --> 3827ms (-26%) Firefox Nightly 30a1 Linux (in a VM)
4681ms --> 3951ms (-16%) Firefox Nightly 30a1 Win7-64
6704ms --> 5649ms (-16%) Chrome 34 dev Linux (in a VM)
5538ms --> 4797ms (-13%) Chrome 34 dev Win7-64