Skip to content
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

Increases chunk size in SMask composition to 1M pixels #5524

Merged
merged 1 commit into from
Dec 5, 2014

Conversation

fkaelberer
Copy link
Contributor

This PR increases the chunk size for SMask composition from 64k to 1M pixels to speed up #5515.
Chunking avoids the duplication of large buffers when ctx.getImageData() is called in favor for the duplication of many small buffers. But since calling ctx.[get|put]ImageData() is soo slow, too small chunks slow down SMask processing significantly.
The 1M chunk size makes decoding #5515 several times faster (unless the zoom level is very small). Issue #2648 renders also noticeably quicker.

I was surprised so see that this PR also reduces peak memory consumption:

Chunk Size Peak Mem
64k >2000M
1M ~820M
8M ~920M

(using win7 x64, pdf from issue 5515 at zoom=200, http://www.partnerplast.com/images/seismikk/2844_PPMSG_Seismic_REV_012014_PREVEIW.pdf#zoom=200&page=10)

@Snuffleupagus
Copy link
Collaborator

/botio test

@pdfjsbot
Copy link

pdfjsbot commented Dec 3, 2014

From: Bot.io (Windows)


Received

Command cmd_test from @Snuffleupagus received. Current queue size: 0

Live output at: http://107.22.172.223:8877/158e2816d990bed/output.txt

@pdfjsbot
Copy link

pdfjsbot commented Dec 3, 2014

From: Bot.io (Linux)


Received

Command cmd_test from @Snuffleupagus received. Current queue size: 0

Live output at: http://107.21.233.14:8877/bb05148fdbf247d/output.txt

@pdfjsbot
Copy link

pdfjsbot commented Dec 3, 2014

From: Bot.io (Windows)


Success

Full output at http://107.22.172.223:8877/158e2816d990bed/output.txt

Total script time: 20.69 mins

  • Font tests: Passed
  • Unit tests: Passed
  • Regression tests: Passed

@pdfjsbot
Copy link

pdfjsbot commented Dec 3, 2014

From: Bot.io (Linux)


Success

Full output at http://107.21.233.14:8877/bb05148fdbf247d/output.txt

Total script time: 23.88 mins

  • Font tests: Passed
  • Unit tests: Passed
  • Regression tests: Passed

@CodingFabian
Copy link
Contributor

this might be pure guessing, but afaik this causes the memory to be used on the graphics card instead of main memory.
I stumbled across the pixel limitations a few times and always wondered what the real purpose is. because mask and layer are in memory fully. so what the chunking does is that the get pixel data regions are only created for a smaller subpart, which would affect peak memory rather than total memory use.
64k is pretty low, i think 1M is much more reasonable.
+1 for the change.

@CodingFabian
Copy link
Contributor

Its a 4 times improvement for referenced doc on page 10 for me.
before:
Page: 10
Page Request 15ms
Rendering 4689ms
Overall 4704ms

after:
Page: 10
Page Request 20ms
Rendering 1114ms
Overall 1134ms

yurydelendik added a commit that referenced this pull request Dec 5, 2014
Increases chunk size in SMask composition to 1M pixels
@yurydelendik yurydelendik merged commit a3df129 into mozilla:master Dec 5, 2014
@yurydelendik
Copy link
Contributor

Really good. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants