1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-20 07:08:08 +02:00
pdf.js/test
Jonas Jenwald 0c2ebda31c Cache JPEG images, just as we do for other image formats, in evaluator.js (issue 8380)
For some reason, we're putting all kind of images *except* JPEG into the `imageCache` in `evaluator.js`.[1]
This means that in the PDF file in issue 8380, we'll keep sending the *same* two small images[2] to the main-thread and decoding them over and over. This is obviously hugely inefficient!

As can be seen from the discussion in the issue, the performance becomes *extremely* bad if the user has the addon "Adblock Plus" installed. However, even in a clean Firefox profile, the performance isn't that great.

This patch not only addresses the performance implications of the "Adblock Plus" addon together with that particular PDF file, but it *also* improves the rendering times considerably for *all* users.
Locally, with a clean profile, the rendering times are reduced from `~2000 ms` to `~500 ms` for my setup!

Obviously, the general structure of the PDF file and its operator sequence is still hugely inefficient, however I'd say that the performance with this patch is good enough to consider the issue (as it stands) resolved.[3]

Fixes 8380.

---
[1] Not technically true, since inline images are cached from `parser.js`, but whatever :-)

[2] The two JPEG images have dimensions 1x2, respectively 4x2.

[3] To make this even more efficient, a new state would have to be added to the `QueueOptimizer`. Given that PDF files this stupid fortunately aren't too common, I'm not convinced that it's worth doing.
2017-05-07 13:07:41 +02:00
..
chromium Enable the object-shorthand ESLint rule 2017-04-30 11:13:34 +02:00
features Remove usage of mozFillRule 2017-01-29 23:24:44 +01:00
font Enable the object-shorthand ESLint rule 2017-04-30 11:13:34 +02:00
pdfs Cache JPEG images, just as we do for other image formats, in evaluator.js (issue 8380) 2017-05-07 13:07:41 +02:00
resources Bots: disable the default browser test and enable E10s 2017-04-27 20:39:57 +02:00
stats Adjust the brace-style ESLint rule to disallow single lines (and also enable no-iterator) 2017-02-04 15:53:08 +01:00
ttx Update fonttools location and version (issue 6223) 2015-07-17 12:51:09 +02:00
unit Merge pull request #8358 from Snuffleupagus/PartialEvaluator-method-signatures 2017-05-04 08:10:30 -05:00
.eslintrc Switch to using ESLint, instead of JSHint, for linting 2016-12-16 21:06:36 +01:00
.gitignore Ignore test snapshots directory. 2013-03-15 11:24:08 -07:00
annotation_layer_test.css Button widget annotations: improve unit tests, simplify code and remove labels 2016-12-17 20:38:48 +01:00
downloadutils.js Enable the object-shorthand ESLint rule 2017-04-30 11:13:34 +02:00
driver.js Enable the object-shorthand ESLint rule 2017-04-30 11:13:34 +02:00
test.js Enable the object-shorthand ESLint rule 2017-04-30 11:13:34 +02:00
test_manifest.json Cache JPEG images, just as we do for other image formats, in evaluator.js (issue 8380) 2017-05-07 13:07:41 +02:00
test_slave.html Replaces RequireJS to SystemJS. 2017-02-27 08:32:39 -06:00
testutils.js Switch to using ESLint, instead of JSHint, for linting 2016-12-16 21:06:36 +01:00
text_layer_test.css Better "text" testing. 2015-11-19 11:03:52 -06:00
webbrowser.js Add no-default-browser-check to chrome runner. 2017-05-03 11:22:08 -07:00
webserver.js Enable the object-shorthand ESLint rule 2017-04-30 11:13:34 +02:00