Right-size the map array in PartialEvaluator_readToUnicode

We can avoid a lot of intermediate resizings, by directly allocating the required number of elements for the `map` array.
This commit is contained in:
Jonas Jenwald 2015-09-19 16:54:19 +02:00
parent 20b5814249
commit 8d831449ab
3 changed files with 12 additions and 1 deletions

View file

@ -1380,7 +1380,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
if (cmap instanceof IdentityCMap) {
return new IdentityToUnicodeMap(0, 0xFFFF);
}
var map = [];
var map = new Array(cmap.length);
// Convert UTF-16BE
// NOTE: cmap can be a sparse array, so use forEach instead of for(;;)
// to iterate over all keys.