Merge pull request #5078 from nnethercote/Ref-toString
Optimize Ref_toString().
This commit is contained in:
commit
2aea7d7047
@ -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;
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user