-
Notifications
You must be signed in to change notification settings - Fork 10.4k
[api-minor] Add a temporary function-cache in AlternateCS.prototype.getRgbBuffer, and disable eval support by default
#19428
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
base: master
Are you sure you want to change the base?
Conversation
d36ce6c to
40d5b7c
Compare
648e0af to
47c9a21
Compare
0eff81f to
996c17f
Compare
996c17f to
91cd22b
Compare
AlternateCS.prototype.getRgbBufferAlternateCS.prototype.getRgbBuffer, and disable eval support by default
From: Bot.io (Linux m4)ReceivedCommand cmd_test from @Snuffleupagus received. Current queue size: 0 Live output at: http://54.241.84.105:8877/d37b93ee73f9f2c/output.txt |
From: Bot.io (Windows)ReceivedCommand cmd_test from @Snuffleupagus received. Current queue size: 0 Live output at: http://54.193.163.58:8877/78e6049b82cdea9/output.txt |
AlternateCS.prototype.getRgbBuffer, and disable eval support by defaultAlternateCS.prototype.getRgbBuffer, and disable eval support by default
From: Bot.io (Linux m4)FailedFull output at http://54.241.84.105:8877/d37b93ee73f9f2c/output.txt Total script time: 30.69 mins
|
From: Bot.io (Windows)FailedFull output at http://54.193.163.58:8877/78e6049b82cdea9/output.txt Total script time: 59.37 mins
Image differences available at: http://54.193.163.58:8877/78e6049b82cdea9/reftest-analyzer.html#web=eq.log |
91cd22b to
7611e64
Compare
This supplements, rather than replaces, the existing caching in `PDFFunction.constructPostScript` since that one still makes sense given that functions are cached on the page-level. Using an additional cache helps improve performance because: - There are many fewer function calls, and overall less parsing this way. - For the common case of `Uint8Array`-data we're able to use integer cache-keys, which is a lot faster than string concatenation. This significantly improves performance of the `pr5134` test-case with `isEvalSupported = false` set, and testing locally in the viewer: - With the `master` branch and `isEvalSupported = true`, page 2 renders in approx. 340 milliseconds. - With the `master` branch and `isEvalSupported = false`, page 2 renders in approx. 1200 milliseconds. - With this patch and `isEvalSupported = false`, page 2 renders in approx. 380 milliseconds. While this is obviously still slower, the difference is now small enough that it shouldn't be too much of an issue in practice (compare with PR 18070) and the `pr5134` test-case is an especially "bad" one w.r.t. its PostScript function use.
The idea behind this patch is to see if disabling of `eval` leads to any reports about bad performance, since the previous patch should have improved things a fair bit.
7611e64 to
602824b
Compare
Add a temporary function-cache in
AlternateCS.prototype.getRgbBufferThis supplements, rather than replaces, the existing caching in
PDFFunction.constructPostScriptsince that one still makes sense given that functions are cached on the page-level.Using an additional cache helps improve performance because:
There are many fewer function calls, and overall less parsing this way.
For the common case of
Uint8Array-data we're able to use integer cache-keys, which is a lot faster than string concatenation.This significantly improves performance of the
pr5134test-case withisEvalSupported = falseset, and testing locally in the viewer:With the
masterbranch andisEvalSupported = true, page 2 renders in approx. 340 milliseconds.With the
masterbranch andisEvalSupported = false, page 2 renders in approx. 1200 milliseconds.With this patch and
isEvalSupported = false, page 2 renders in approx. 380 milliseconds.While this is obviously still slower, the difference is now small enough that it shouldn't be too much of an issue in practice (compare with PR Use fuzzy-matching to improve cache hit rates with
PostScriptEvaluator#18070) and thepr5134test-case is an especially "bad" one w.r.t. its PostScript function use.[api-minor] Disable
evalsupport by defaultThe idea behind this patch is to see if disabling of
evalleads to any reports about bad performance, since the previous patch should have improved things a fair bit.