Esprima: Speed Comparison

# Compare with other parsers

Time measurement is carried out using Benchmark.js.

Esprima version .

Please wait...

Source | Size (KiB) | Esprima | parse-js | ZeParser | Narcissus
--- | --- | --- | --- | --- | ---
jQuery 1.7.1 |  |  |  |  |
Prototype 1.7.0.0 |  |  |  |  |
MooTools 1.4.1 |  |  |  |  |
Ext Core 3.1.0 |  |  |  |  |
Total |  |  |  |  |

Warning: Since each parser has a different format for the syntax tree, the speed is not fully comparable (the cost of constructing different result is not taken into account). These tests exist only to ensure that Esprima parser is not ridiculously slow compare to other parsers.

parse-js is the parser used in UglifyJS. It's a JavaScript port of the Common LISP version. This test uses `parse-js` from UglifyJS version 1.2.5 (Jan 13 2011).

ZeParser is from github.com/qfox/ZeParser revision 51e52908 (dated Dec 24 2011). Beside the syntax tree, ZeParser also provides location info for the syntax nodes, as well as the list of all tokens.

Narcissus is Mozilla's JavaScript engine implemented in JavaScript. This test uses the parser from Narcissus, taken from its code repository revision b5caa7df (dated Oct 26 2011). Narcissus supports many extensions (generators, comprehension, destructuring, etc) and therefore it takes longer to parse JavaScript code. Narcissus parser output also contains the location info for the syntax node. Note: Narcissus will not work if `Object.create` and `Object.defineProperty` are not available.