diff --git a/src/core/obj.js b/src/core/obj.js index 0762adce8..98e7a1722 100644 --- a/src/core/obj.js +++ b/src/core/obj.js @@ -220,7 +220,13 @@ var Ref = (function RefClosure() { Ref.prototype = { toString: function Ref_toString() { - return 'R' + this.num + '.' + this.gen; + // 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 str; } };