mozilla/pdf.js — pull request #5524 by fkaelberer (2014-12-03 10:38:21+00:00)
Title: Increases chunk size in SMask composition to 1M pixels

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)