disabling traces in the jison parser fixes the performance problems -- ahh, much better

This commit is contained in:
Jeremy Ashkenas
2010-02-11 18:34:30 -05:00
parent e19b67cb79
commit a379530d41

View File

@@ -436,8 +436,8 @@ parse: function parse(input) {
var symbol, state, action, a, r, yyval={},p,len,ip=0,newState, expected;
symbol = lex();
while (true) {
this.trace('stack:',JSON.stringify(stack), '\n\t\t\tinput:', this.lexer._input);
this.trace('vstack:',JSON.stringify(vstack));
// this.trace('stack:',JSON.stringify(stack), '\n\t\t\tinput:', this.lexer._input);
// this.trace('vstack:',JSON.stringify(vstack));
// set first input
state = stack[stack.length-1];
// read action for current state and first input
@@ -454,7 +454,7 @@ parse: function parse(input) {
{text: this.lexer.match, token: symbol, line: this.lexer.yylineno});
}
this.trace('action:',action);
// this.trace('action:',action);
// this shouldn't happen, unless resolve defaults are off
if (action.length > 1) {
@@ -481,7 +481,7 @@ parse: function parse(input) {
reductions++;
len = this.productions_[a[1]][1];
this.trace('reduce by: ', this.productions ? this.productions[a[1]] : a[1]);
// this.trace('reduce by: ', this.productions ? this.productions[a[1]] : a[1]);
// perform semantic action
yyval.$ = vstack[vstack.length-len]; // default to $$ = $1
@@ -491,11 +491,11 @@ parse: function parse(input) {
return r;
}
this.trace('yyval=',JSON.stringify(yyval.$));
// this.trace('yyval=',JSON.stringify(yyval.$));
// pop off stack
if (len) {
this.trace('production length:',len);
// this.trace('production length:',len);
stack = stack.slice(0,-1*len*2);
vstack = vstack.slice(0, -1*len);
}
@@ -509,10 +509,10 @@ parse: function parse(input) {
case 3: // accept
this.trace('stack:',stack, '\n\tinput:', this.lexer._input);
this.trace('vstack:',JSON.stringify(vstack));
this.trace('Total reductions:', reductions);
this.trace('Total shifts:', shifts);
// this.trace('stack:',stack, '\n\tinput:', this.lexer._input);
// this.trace('vstack:',JSON.stringify(vstack));
// this.trace('Total reductions:', reductions);
// this.trace('Total shifts:', shifts);
return true;
}