Switch to push instead of slice. Faster on jsperf, but doesn't seem to be faster testing locally.

This commit is contained in:
Brendan Dahl 2011-12-30 14:59:00 -08:00
parent acd64d75f3
commit df1e22f2e4

View File

@ -437,8 +437,9 @@ var PostScriptStack = (function PostScriptStackClosure() {
copy: function copy(n) {
if (this.stack.length + n >= MAX_STACK_SIZE)
error('PostScript function stack overflow.');
var part = this.stack.slice(this.stack.length - n);
this.stack = this.stack.concat(part);
var stack = this.stack;
for (var i = stack.length - n, j = n - 1; j >= 0; j--, i++)
stack.push(stack[i]);
},
index: function index(n) {
this.push(this.stack[this.stack.length - n - 1]);