1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-26 10:08:06 +02:00

Make the decryptAscii helper function, in src/core/type1_parser.js, slightly more efficient

By slicing the Uint8Array directly, rather than using the prototype and a `call` invocation, the runtime of `decryptAscii` is decreased slightly (~30% based on quick logging).
The `decryptAscii` function is still less efficient than `decrypt`, however ASCII encoded Type1 font programs are sufficiently rare that it probably doesn't matter much (we've only seen *two* examples, issue 4630 and 11740).
This commit is contained in:
Jonas Jenwald 2020-03-26 12:49:20 +01:00
parent 938d519192
commit 8770ca3014
2 changed files with 10 additions and 1 deletions

View file

@ -437,7 +437,7 @@ var Type1Parser = (function Type1ParserClosure() {
r = ((value + r) * c1 + c2) & ((1 << 16) - 1);
}
}
return Array.prototype.slice.call(decrypted, discardNumber, j);
return decrypted.slice(discardNumber, j);
}
function isSpecial(c) {