JavaScript Parsing Libraries Benchmark

A JSON Parser was implemented using each of these Parsing Libraries (Generators/Combinators/DSLs):

  1. Chevrotain Parsing DSL implementation

  2. Parsimmon Parser Combinator implementation

  3. ANTLR4 Parser Generator grammar -> generated code

  4. Peggy Parser Generator grammar -> generated code

  5. abandoned: PEG.js Parser Generator grammar -> generated code

  6. Jison parser Generator grammar -> generated code

  7. Nearley Parser Generator grammar -> generated code with Moo Lexer

  8. Ohm-js Parser Library grammar -> parser

The JSON Grammar was used because it is simple to implement, simple to compare and is often already available as a sample grammar for most parsing tools.

The input sample for the benchmark is a ~1,000 lines JSON file generated by json-generator.

See the benchmark methodology for details on what is being tested and how.

Benchmarking is done using the benchmark.js library.

The entire source code for this benchmark can be found in this github repository.

 
Library
Ops/sec
Relative Speed
?