Closed Bug 962933 Opened 6 years ago Closed 6 years ago
.js: be smarter about passing image data from the worker
Currently, we decode all images in a PDF into a 32-bit RGBA buffer in the worker, and then pass that to the main thread, which puts the data to a canvas (in slices, so the main thread doesn't need to use much memory). There are some cases where this is outrageously inefficient. For example, scanned black and white documents are common. They have one bit per pixel, and so expanding to a 32-bit RGBA buffer is a 32x increase. Therefore, for certain common, easy cases, we should allow image data to be passed in a form other than 32-bit RGBA. 1-bit black and white is the obvious first alternative. This complicates things for the main thread display code, but it's worth it. I have a draft patch implementing this. For http://pbadupws.nrc.gov/docs/ML0909/ML090920467.pdf, if you scroll all the way to the bottom and wait for the last page to display... - Currently, it takes about 200 seconds, and RSS peaks at 7,800 MiB. - With my patch, it takes about 25 seconds, and RSS peaks at about 690 MiB.
The patch is at https://github.com/mozilla/pdf.js/pull/4181
The patch has been merged to pdf.js master: https://github.com/mozilla/pdf.js/commit/c5a804c43a2ad7d01dbd165558122e1790245f99
RyanVM, do we have a bug open for another pdf.js uplift before FF29's dev cycle closes?
No, but feel free to file and assign to me if you want. Otherwise, I'll take care of it.
Fixed on trunk by bug 965861.
Assignee: nobody → n.nethercote
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 29
You need to log in before you can comment on or make changes to this bug.