Avoid an allocation in readCharCode().
readCharCode() returns two values, and currently allocates a length-2 array on every call to do so. This change makes it instead us a passed-in object which can be reused. This tiny change reduces the total JS allocations done for the document in Mozilla bug 992125 by 4.2%.
This commit is contained in:
parent
0e4d9061b2
commit
61e6b576d4
3 changed files with 21 additions and 16 deletions
|
@ -4574,10 +4574,11 @@ var Font = (function FontClosure() {
|
|||
if (this.cMap) {
|
||||
// composite fonts have multi-byte strings convert the string from
|
||||
// single-byte to multi-byte
|
||||
var c = {};
|
||||
while (i < chars.length) {
|
||||
var c = this.cMap.readCharCode(chars, i);
|
||||
charcode = c[0];
|
||||
var length = c[1];
|
||||
this.cMap.readCharCode(chars, i, c);
|
||||
charcode = c.charcode;
|
||||
var length = c.length;
|
||||
i += length;
|
||||
glyph = this.charToGlyph(charcode);
|
||||
glyphs.push(glyph);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue