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.
Store line number and range right when creating the token object.
In the modern JavaScript engines with the property-access optimization
via object structure cache ("hidden class"), modifying the object right
after its construction causes small performance penalty and thus should
be avoided.
In our case, since advance() mandates the need for line number and range
in the token object, we might as well prepare these properties during
token construction.
Firefox 9 running the full benchmarks suite shows 14% speed-up.
The performance change is not noticeable on Chrome and Safari.
http://code.google.com/p/esprima/issues/detail?id=136- Loading branch information
Showing
1 changed file
with
73 additions
and
34 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