Merge pull request #10394 from timvandermeij/primitives-optimization

Optimize the `Ref` class in `src/core/primitives.js`
This commit is contained in:
Tim van der Meij 2018-12-30 12:30:09 +01:00 committed by GitHub
commit 85363f4566
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -185,11 +185,10 @@ var Ref = (function RefClosure() {
toString: function Ref_toString() {
// This function is hot, so we make the string as compact as possible.
// |this.gen| is almost always zero, so we treat that case specially.
var str = this.num + 'R';
if (this.gen !== 0) {
str += this.gen;
return `${this.num}R${this.gen}`;
}
return str;
return `${this.num}R`;
},
};