-
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
Add different code-paths to {CMap, ToUnicodeMap}.charCodeOf
depending on length, since Array.prototype.indexOf
can be extremely inefficient for very large arrays (issue 8372)
#8442
Conversation
{CMap, ToUnicodeMap}.charCodeOf
depending on length, since Array.prototype.indexOf
can be very inefficient for extremely large arrays (issue 8372){CMap, ToUnicodeMap}.charCodeOf
depending on length, since Array.prototype.indexOf
can be extremely inefficient for very large arrays (issue 8372)
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.
Looks good
…ng on length, since `Array.prototype.indexOf` can be extremely inefficient for very large arrays (issue 8372) Fixes 8372.
@yurydelendik Thank you for the review! I realized that I made a stupid mistake: Since diff --git a/src/core/cmap.js b/src/core/cmap.js
index abe2756b..0c9faa4e 100644
--- a/src/core/cmap.js
+++ b/src/core/cmap.js
@@ -307,7 +307,7 @@ var CMap = (function CMapClosure() {
}
for (let charCode in map) {
if (map[charCode] === value) {
- return charCode;
+ return (charCode | 0);
}
}
return -1;
diff --git a/src/core/fonts.js b/src/core/fonts.js
index 4ed6f90f..3a2d361b 100644
--- a/src/core/fonts.js
+++ b/src/core/fonts.js
@@ -292,7 +292,7 @@ var ToUnicodeMap = (function ToUnicodeMapClosure() {
}
for (let charCode in map) {
if (map[charCode] === value) {
- return charCode;
+ return (charCode | 0);
}
}
return -1; |
/botio test |
From: Bot.io (Windows)ReceivedCommand cmd_test from @Snuffleupagus received. Current queue size: 0 Live output at: http://54.215.176.217:8877/3b6dbaf4ad9423d/output.txt |
From: Bot.io (Linux m4)ReceivedCommand cmd_test from @Snuffleupagus received. Current queue size: 0 Live output at: http://54.67.70.0:8877/48433821fed4bef/output.txt |
From: Bot.io (Windows)SuccessFull output at http://54.215.176.217:8877/3b6dbaf4ad9423d/output.txt Total script time: 24.59 mins
|
From: Bot.io (Linux m4)SuccessFull output at http://54.67.70.0:8877/48433821fed4bef/output.txt Total script time: 25.05 mins
|
/botio makeref |
From: Bot.io (Linux m4)ReceivedCommand cmd_makeref from @Snuffleupagus received. Current queue size: 0 Live output at: http://54.67.70.0:8877/a4dd4d5167c1d0e/output.txt |
From: Bot.io (Windows)ReceivedCommand cmd_makeref from @Snuffleupagus received. Current queue size: 0 Live output at: http://54.215.176.217:8877/92e71eefc2c10cc/output.txt |
From: Bot.io (Linux m4)FailedFull output at http://54.67.70.0:8877/a4dd4d5167c1d0e/output.txt Total script time: 15.07 mins
|
From: Bot.io (Windows)SuccessFull output at http://54.215.176.217:8877/92e71eefc2c10cc/output.txt Total script time: 23.27 mins
|
/botio-linux makeref |
From: Bot.io (Linux m4)ReceivedCommand cmd_makeref from @Snuffleupagus received. Current queue size: 1 Live output at: http://54.67.70.0:8877/353c0cc35d8c92e/output.txt |
From: Bot.io (Linux m4)FailedFull output at http://54.67.70.0:8877/353c0cc35d8c92e/output.txt Total script time: 18.29 mins
|
/botio-linux makeref |
From: Bot.io (Linux m4)ReceivedCommand cmd_makeref from @Snuffleupagus received. Current queue size: 0 Live output at: http://54.67.70.0:8877/6c495996b723df3/output.txt |
From: Bot.io (Linux m4)FailedFull output at http://54.67.70.0:8877/6c495996b723df3/output.txt Total script time: 23.01 mins
|
/botio-linux makeref |
From: Bot.io (Linux m4)ReceivedCommand cmd_makeref from @Snuffleupagus received. Current queue size: 0 Live output at: http://54.67.70.0:8877/0cc38d0b8835af9/output.txt |
From: Bot.io (Linux m4)SuccessFull output at http://54.67.70.0:8877/0cc38d0b8835af9/output.txt Total script time: 23.70 mins
|
Add different code-paths to `{CMap, ToUnicodeMap}.charCodeOf` depending on length, since `Array.prototype.indexOf` can be extremely inefficient for very large arrays (issue 8372)
Fixes #8372.