1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-23 00:28:06 +02:00
pdf.js/src/core
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
..
annotation.js Change the signatures of the PartialEvaluator "constructor" and its getOperatorList/getTextContent methods to take parameter objects 2017-05-03 12:10:20 +02:00
arithmetic_decoder.js Adds UMD headers to core, display and shared files. 2015-12-15 13:24:39 -06:00
bidi.js Enable the object-shorthand ESLint rule in src/shared 2017-04-27 17:29:40 +02:00
cff_parser.js Enable the object-shorthand ESLint rule in src/shared 2017-04-27 17:29:40 +02:00
charsets.js Adds UMD headers to core, display and shared files. 2015-12-15 13:24:39 -06:00
chunked_stream.js Replace unnecessary bind(this) and var self = this statements with arrow functions in remaining src/core/ files 2017-05-02 15:47:43 +02:00
cmap.js Enable the object-shorthand ESLint rule in src/shared 2017-04-27 17:29:40 +02:00
colorspace.js Enable the no-else-return ESLint rule 2017-01-09 20:27:39 +01:00
crypto.js Enable the no-unused-vars ESLint rule 2017-01-29 23:23:17 +01:00
document.js Change the signatures of the PartialEvaluator "constructor" and its getOperatorList/getTextContent methods to take parameter objects 2017-05-03 12:10:20 +02:00
encodings.js Refactor Encodings 2016-01-28 11:32:59 -06:00
evaluator.js Cache JPEG images, just as we do for other image formats, in evaluator.js (issue 8380) 2017-05-07 13:07:41 +02:00
font_renderer.js Enable the object-shorthand ESLint rule in src/shared 2017-04-27 17:29:40 +02:00
fonts.js Replace unnecessary bind(this) and var self = this statements with arrow functions in remaining src/core/ files 2017-05-02 15:47:43 +02:00
function.js Enable the object-shorthand ESLint rule in src/shared 2017-04-27 17:29:40 +02:00
glyphlist.js Allow to convert (some of) ES6 code to ES5. 2017-04-14 14:39:25 -05:00
image.js Enable the object-shorthand ESLint rule in src/shared 2017-04-27 17:29:40 +02:00
jbig2.js Merge pull request #8342 from Snuffleupagus/eslint_object-shorthand-src-core 2017-04-29 23:59:20 +02:00
jpg.js Enable the object-shorthand ESLint rule in src/shared 2017-04-27 17:29:40 +02:00
jpx.js Enable the object-shorthand ESLint rule in src/shared 2017-04-27 17:29:40 +02:00
metrics.js Lazify Metrics 2016-01-28 12:11:46 -06:00
murmurhash3.js Moves Uint32ArrayView and hasCanvasTypedArrays into compatibility.js. 2017-04-14 10:04:52 -05:00
network.js Enable the object-shorthand ESLint rule in src/shared 2017-04-27 17:29:40 +02:00
obj.js Replace unnecessary bind(this) and var self = this statements with arrow functions in remaining src/core/ files 2017-05-02 15:47:43 +02:00
parser.js Ignore line-breaks between operator and digit in Lexer.getNumber 2017-05-02 20:59:42 +02:00
pattern.js Enable the object-shorthand ESLint rule in src/shared 2017-04-27 17:29:40 +02:00
pdf_manager.js Enable the object-shorthand ESLint rule in src/shared 2017-04-27 17:29:40 +02:00
primitives.js Move EOF/isEOF from core/parser.js to core/primitives.js 2017-01-27 13:37:48 +01:00
ps_parser.js Move EOF/isEOF from core/parser.js to core/primitives.js 2017-01-27 13:37:48 +01:00
standard_fonts.js Improve rendering of non-embedded NuptialScript font 2016-11-22 17:56:17 +01:00
stream.js Enable the object-shorthand ESLint rule in src/shared 2017-04-27 17:29:40 +02:00
type1_parser.js Enable the object-shorthand ESLint rule in src/shared 2017-04-27 17:29:40 +02:00
unicode.js Allow to convert (some of) ES6 code to ES5. 2017-04-14 14:39:25 -05:00
worker.js Change the signatures of the PartialEvaluator "constructor" and its getOperatorList/getTextContent methods to take parameter objects 2017-05-03 12:10:20 +02:00