forked from jquery/esprima
-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use stack-based approach for parsing binary expressions.
Instead of going recursively, binary expressions are parsed using shift-reduce strategy with a simple stack mechanism. It makes Esprima more similar to the parser in V8 and JavaScriptCore. Also, this means that we don't exhaust JavaScript engine's stack anymore for a really complex expression. Speed-up is noticeable due to the elimination of the long chain of recursive calls. V8 3.13.7 shows at least 8% improvement. See also the discussion in the mailing-list: https://groups.google.com/d/topic/esprima/FqjWJc6UawA/ http://code.google.com/p/esprima/issues/detail?id=352
- Loading branch information
Showing
1 changed file
with
102 additions
and
167 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters