-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Represent cid chars using integers, not strings. #5111
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
Conversation
@@ -210,18 +214,24 @@ var CMap = (function CMapClosure() { | |||
this.numCodespaceRanges++; | |||
}, | |||
|
|||
mapRange: function(low, high, dstLow) { | |||
mapCidRange: function(low, high, dstLow) { | |||
var lastByte = dstLow.length - 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: This line is now superfluous.
cid chars are 16-bit unsigned integers. Currently we convert them to single-char strings when inserting them into the CMap, and then convert them back to integers when extracting them from the CMap. This patch changes CMap so that cid chars stay in integer format throughout, saving both time and space. When loading the PDF from issue mozilla#4580, this change reduces peak RSS from ~600 to ~370 MiB. It also improves overall speed on that PDF by ~26%, going from 724 ms to 533 ms.
I removed the line of dead code. |
/botio test |
From: Bot.io (Windows)ReceivedCommand cmd_test from @Snuffleupagus received. Current queue size: 0 Live output at: http://107.22.172.223:8877/4d7720a8bf14435/output.txt |
From: Bot.io (Linux)ReceivedCommand cmd_test from @Snuffleupagus received. Current queue size: 0 Live output at: http://107.21.233.14:8877/5aba5d3fdf2b161/output.txt |
From: Bot.io (Windows)SuccessFull output at http://107.22.172.223:8877/4d7720a8bf14435/output.txt Total script time: 19.75 mins
|
From: Bot.io (Linux)FailedFull output at http://107.21.233.14:8877/5aba5d3fdf2b161/output.txt Total script time: 23.02 mins
Image differences available at: http://107.21.233.14:8877/5aba5d3fdf2b161/reftest-analyzer.html#web=eq.log |
I wonder how the linux ref image got fixed. Otherwise it looks good. |
I don't know. I didn't see that change on my Linux machine. In theory the visible behaviour should be unchanged. |
Oh, it's Chromium-only. I can reproduce the difference now. Seems like a clear improvement... :) |
I've worked out what changed. It's related to the way the
Now consider the new code.
I haven't worked out why this causes different behaviour in Firefox and Chromium. But I can replicate the Chromium bug with my patch applied if I add So my patch is clearly an improvement, but the handling of @yurydelendik, what do you think? |
That's good. I just wanted to know the reason. Thanks for checking this out. We just need to file a new issue for that. |
I filed #5132 for the |
/botio test |
From: Bot.io (Windows)ReceivedCommand cmd_test from @yurydelendik received. Current queue size: 0 Live output at: http://107.22.172.223:8877/871855041bd5bca/output.txt |
From: Bot.io (Linux)ReceivedCommand cmd_test from @yurydelendik received. Current queue size: 0 Live output at: http://107.21.233.14:8877/625a34a08028cb4/output.txt |
From: Bot.io (Windows)SuccessFull output at http://107.22.172.223:8877/871855041bd5bca/output.txt Total script time: 19.75 mins
|
From: Bot.io (Linux)FailedFull output at http://107.21.233.14:8877/625a34a08028cb4/output.txt Total script time: 22.91 mins
Image differences available at: http://107.21.233.14:8877/625a34a08028cb4/reftest-analyzer.html#web=eq.log |
/botio-linux makeref |
From: Bot.io (Linux)ReceivedCommand cmd_makeref from @yurydelendik received. Current queue size: 0 Live output at: http://107.21.233.14:8877/84a5e71335580d0/output.txt |
Represent cid chars using integers, not strings.
Thank you for the patch |
From: Bot.io (Linux)SuccessFull output at http://107.21.233.14:8877/84a5e71335580d0/output.txt Total script time: 22.72 mins
|
cid chars are 16-bit unsigned integers. Currently we convert them to
single-char strings when inserting them into the CMap, and then convert
them back to integers when extracting them from the CMap. This patch
changes CMap so that cid chars stay in integer format throughout, saving
both time and space.
When loading the PDF from issue #4580, this change reduces peak RSS from
~600 to ~370 MiB. It also improves overall speed on that PDF by ~26%,
going from 724 ms to 533 ms.