-
Notifications
You must be signed in to change notification settings - Fork 10.1k
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
Replace getAll
with getKeys
in PartialEvaluator_hasBlendModes
to speed up loading of badly generated PDF files (issue 6961)
#6971
Conversation
/botio-linux preview |
From: Bot.io (Linux)ReceivedCommand cmd_preview from @Snuffleupagus received. Current queue size: 0 Live output at: http://107.21.233.14:8877/1b80e8aebcddf84/output.txt |
From: Bot.io (Linux)SuccessFull output at http://107.21.233.14:8877/1b80e8aebcddf84/output.txt Total script time: 0.82 mins Published |
…o speed up loading of badly generated PDF files (issue 6961) Some bad PDF generators, in particular "Scribus PDF", duplicates resources *a lot* at various levels of the PDF files. This can lead to `PartialEvaluator_hasBlendModes` taking an unreasonable amount of time to complete. The reason is that the current code is using `Dict_getAll`, which recursively dereferences *all* indirect objects, which can be really slow. This patch instead uses `Dict_getKeys`, and then manually looks up only the necessary indirect objects. I've added the PDF file as a `load` test. The most important thing here is probably to ensure that the file remains available in the repo, and the comment should help reduced the chance of regressions. (Note that locally, the `load` test times out without this patch, but we cannot really assume that that always happens.) Fixes 6961.
/botio test |
From: Bot.io (Linux)ReceivedCommand cmd_test from @Snuffleupagus received. Current queue size: 0 Live output at: http://107.21.233.14:8877/2f4bb738ccf5b16/output.txt |
From: Bot.io (Windows)ReceivedCommand cmd_test from @Snuffleupagus received. Current queue size: 0 Live output at: http://107.22.172.223:8877/bac8e57fa95caa3/output.txt |
From: Bot.io (Windows)SuccessFull output at http://107.22.172.223:8877/bac8e57fa95caa3/output.txt Total script time: 20.11 mins
|
From: Bot.io (Linux)SuccessFull output at http://107.21.233.14:8877/2f4bb738ccf5b16/output.txt Total script time: 21.35 mins
|
Looks good. Thank you for the patch. |
Replace `getAll` with `getKeys` in `PartialEvaluator_hasBlendModes` to speed up loading of badly generated PDF files (issue 6961)
Awesome work, thanks for fixing this so quickly! |
Some bad PDF generators, in particular "Scribus PDF", duplicates resources a lot at various levels of the PDF files. This can lead to
PartialEvaluator_hasBlendModes
taking an unreasonable amount of time to complete.The reason is that the current code is using
Dict_getAll
, which recursively dereferences all indirect objects, which can be really slow. This patch instead usesDict_getKeys
, and then manually looks up only the necessary indirect objects.I've added the PDF file as a
load
test. The most important thing here is probably to ensure that the file remains available in the repo, and the comment should help reduce the chance of regressions. (Note that locally, theload
test times out without this patch, but we cannot really assume that that always happens.)Fixes #6961.