{"id":13605727,"url":"https://github.com/prantlf/ecmascript-parser-benchmark","last_synced_at":"2025-10-07T03:56:27.970Z","repository":{"id":150431654,"uuid":"443759153","full_name":"prantlf/ecmascript-parser-benchmark","owner":"prantlf","description":"Compares the speed and package size of various ECMAScript parsers and code generators.","archived":false,"fork":false,"pushed_at":"2024-07-19T06:42:48.000Z","size":232,"stargazers_count":13,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-08-01T07:56:56.584Z","etag":null,"topics":["benchmark","code-generator","ecmascript","ecmascript-parser","parser"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/prantlf.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-01-02T12:22:09.000Z","updated_at":"2025-07-28T11:09:51.000Z","dependencies_parsed_at":"2024-11-07T10:34:54.591Z","dependency_job_id":"25c03940-dd16-4711-93d4-288f606d1d7d","html_url":"https://github.com/prantlf/ecmascript-parser-benchmark","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/prantlf/ecmascript-parser-benchmark","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prantlf%2Fecmascript-parser-benchmark","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prantlf%2Fecmascript-parser-benchmark/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prantlf%2Fecmascript-parser-benchmark/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prantlf%2Fecmascript-parser-benchmark/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/prantlf","download_url":"https://codeload.github.com/prantlf/ecmascript-parser-benchmark/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prantlf%2Fecmascript-parser-benchmark/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278717446,"owners_count":26033542,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-07T02:00:06.786Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["benchmark","code-generator","ecmascript","ecmascript-parser","parser"],"created_at":"2024-08-01T19:01:02.060Z","updated_at":"2025-10-07T03:56:27.955Z","avatar_url":"https://github.com/prantlf.png","language":"JavaScript","readme":"# ECMAScript Parser and Code Generator Benchmark\n\nCompares the speed and package size of various ECMAScript parsers and code generators.\n\nThe new contender `meriyah` runs twice as fast as the old bard `esprima`. Babel produces an AST, which is not compatible with the other parsers.\n\nGenerating code with `astring` is faster than with `escodegen`.\n\n## Synopsis\n\n    git clone https://github.com/prantlf/ecmascript-parser-benchmark.git\n    cd ecmascript-parser-benchmark\n    pnpm i\n    npm start\n\n## Parsing Speed\n\n### Node.js\n\n    ❯ node perf/script \u0026\u0026 node perf/module \u0026\u0026 \\\n      node perf/script --locations \u0026\u0026 node perf/module --locations\n\n    Parsing jquery.js as a script by...\n      esprima x 92.34 ops/sec ±0.82% (79 runs sampled)\n      acorn x 94.69 ops/sec ±0.61% (81 runs sampled)\n      babel x 45.87 ops/sec ±2.62% (61 runs sampled)\n      hermes x 23.77 ops/sec ±5.10% (44 runs sampled)\n      meriyah x 182 ops/sec ±0.83% (84 runs sampled)\n      kataw x 115 ops/sec ±1.63% (84 runs sampled)\n      seafox x 104 ops/sec ±1.95% (76 runs sampled)\n      cherow x 135 ops/sec ±2.11% (77 runs sampled)\n      escaya x 91.67 ops/sec ±1.76% (70 runs sampled)\n      tenko x 68.73 ops/sec ±1.37% (71 runs sampled)\n\n    Parsing collection-view.js as a module by...\n      esprima x 1,558 ops/sec ±0.73% (91 runs sampled)\n      acorn x 1,467 ops/sec ±0.58% (94 runs sampled)\n      babel x 1,228 ops/sec ±3.77% (88 runs sampled)\n      hermes x 460 ops/sec ±0.58% (93 runs sampled)\n      meriyah x 2,659 ops/sec ±2.09% (86 runs sampled)\n      kataw x 2,234 ops/sec ±1.03% (89 runs sampled)\n      seafox x 2,272 ops/sec ±3.51% (89 runs sampled)\n      cherow x 2,911 ops/sec ±1.04% (92 runs sampled)\n      escaya x 2,456 ops/sec ±2.24% (90 runs sampled)\n      tenko x 1,152 ops/sec ±1.10% (90 runs sampled)\n      tree-sitter x 325 ops/sec ±1.09% (86 runs sampled)\n\n    Parsing jquery.js as a script with locations by...\n      esprima x 75.89 ops/sec ±1.98% (66 runs sampled)\n      acorn x 55.51 ops/sec ±2.35% (59 runs sampled)\n      babel x 43.29 ops/sec ±3.45% (58 runs sampled)\n      hermes x 24.15 ops/sec ±4.71% (44 runs sampled)\n      meriyah x 91.36 ops/sec ±3.27% (67 runs sampled)\n      kataw x 86.75 ops/sec ±2.78% (65 runs sampled)\n      seafox x 79.40 ops/sec ±2.77% (69 runs sampled)\n      cherow x 85.76 ops/sec ±2.68% (64 runs sampled)\n      escaya x 81.44 ops/sec ±2.02% (70 runs sampled)\n      tenko x 55.39 ops/sec ±2.80% (59 runs sampled)\n\n    Parsing collection-view.js as a module with locations by...\n      esprima x 1,368 ops/sec ±1.39% (92 runs sampled)\n      acorn x 1,190 ops/sec ±0.95% (92 runs sampled)\n      babel x 1,151 ops/sec ±0.88% (91 runs sampled)\n      hermes x 426 ops/sec ±1.06% (87 runs sampled)\n      meriyah x 2,206 ops/sec ±0.74% (90 runs sampled)\n      kataw x 2,071 ops/sec ±1.26% (86 runs sampled)\n      seafox x 2,057 ops/sec ±0.85% (90 runs sampled)\n      cherow x 2,228 ops/sec ±0.84% (90 runs sampled)\n      escaya x 2,171 ops/sec ±1.11% (85 runs sampled)\n      tenko x 1,015 ops/sec ±1.09% (90 runs sampled)\n      tree-sitter x 309 ops/sec ±1.31% (87 runs sampled)\n\nThe `hermes` parser always creates an AST with source code locations. They cannot be disabled to gain more performance.\n\nThe `tree-sitter` parser always creates an AST with source code locations. They cannot be disabled to gain more performance. It makes no difference between a script and a module either.\n\nThe `tree-sitter` parser failed witn an invalid argument when parsing `jquery.js`.\n\n### Bun\n\n    ❯ bun perf/script.js \u0026\u0026 bun perf/module.js \u0026\u0026 \\\n      bun perf/script --locations \u0026\u0026 node perf/module --locations\n\n    Parsing jquery.js as a script by...\n      esprima x 60.09 ops/sec ±1.71% (63 runs sampled)\n      acorn x 68.57 ops/sec ±1.53% (71 runs sampled)\n      babel x 44.51 ops/sec ±1.68% (58 runs sampled)\n      hermes x 34.13 ops/sec ±1.99% (60 runs sampled)\n      meriyah x 166 ops/sec ±1.38% (77 runs sampled)\n      kataw x 108 ops/sec ±1.67% (72 runs sampled)\n      seafox x 123 ops/sec ±2.14% (73 runs sampled)\n      cherow x 126 ops/sec ±1.90% (72 runs sampled)\n      escaya x 105 ops/sec ±1.94% (69 runs sampled)\n      tenko x 56.54 ops/sec ±3.48% (60 runs sampled)\n\n    Parsing collection-view.js as a module by...\n      esprima x 1,034 ops/sec ±2.60% (89 runs sampled)\n      acorn x 1,102 ops/sec ±1.26% (92 runs sampled)\n      babel x 860 ops/sec ±3.69% (81 runs sampled)\n      hermes x 572 ops/sec ±5.01% (92 runs sampled)\n      meriyah x 2,681 ops/sec ±0.82% (92 runs sampled)\n      kataw x 2,267 ops/sec ±0.83% (93 runs sampled)\n      seafox x 2,353 ops/sec ±0.97% (91 runs sampled)\n      cherow x 2,142 ops/sec ±1.29% (85 runs sampled)\n      escaya x 2,117 ops/sec ±0.98% (91 runs sampled)\n      tenko x 988 ops/sec ±1.21% (88 runs sampled)\n\n    Parsing jquery.js as a script with locations by...\n      esprima x 59.12 ops/sec ±1.38% (62 runs sampled)\n      acorn x 62.63 ops/sec ±0.94% (66 runs sampled)\n      babel x 43.48 ops/sec ±1.76% (58 runs sampled)\n      hermes x 38.07 ops/sec ±1.76% (51 runs sampled)\n      meriyah x 138 ops/sec ±1.70% (79 runs sampled)\n      kataw x 119 ops/sec ±2.44% (77 runs sampled)\n      seafox x 117 ops/sec ±1.80% (75 runs sampled)\n      cherow x 113 ops/sec ±1.60% (74 runs sampled)\n      escaya x 100 ops/sec ±1.56% (74 runs sampled)\n      tenko x 60.35 ops/sec ±1.76% (63 runs sampled)\n\n    Parsing collection-view.js as a module with locations by...\n      esprima x 882 ops/sec ±4.56% (85 runs sampled)\n      acorn x 985 ops/sec ±0.79% (91 runs sampled)\n      babel x 861 ops/sec ±1.49% (87 runs sampled)\n      hermes x 530 ops/sec ±5.70% (89 runs sampled)\n      meriyah x 1,847 ops/sec ±1.86% (85 runs sampled)\n      kataw x 1,795 ops/sec ±1.02% (83 runs sampled)\n      seafox x 1,674 ops/sec ±0.89% (85 runs sampled)\n      cherow x 1,491 ops/sec ±2.34% (82 runs sampled)\n      escaya x 1,661 ops/sec ±1.53% (88 runs sampled)\n      tenko x 908 ops/sec ±1.68% (87 runs sampled)\n\nThe `tree-sitter` parser uses native libraries and `node-gyp`, which doesn't run in Bun.\n\n## Code Generating Speed\n\n### Node.js\n\n    ❯ node perf/generator \u0026\u0026 node perf/generator --source-map\n\n    Generating code for an AST from jquery.js by...\n      escodegen x 104 ops/sec ±0.92% (76 runs sampled)\n      astring x 465 ops/sec ±0.84% (90 runs sampled)\n      babel x 61.33 ops/sec ±0.80% (64 runs sampled)\n\n    Generating code with source maps for an AST from jquery.js by...\n      escodegen x 4.67 ops/sec ±2.16% (16 runs sampled)\n      astring x 97.91 ops/sec ±2.25% (72 runs sampled)\n      babel x 34.96 ops/sec ±3.29% (61 runs sampled)\n\n### Bun\n\n    ❯ bun perf/generator.js \u0026\u0026 bun perf/generator.js --source-map\n\n    Generating code for an AST from jquery.js by...\n      escodegen x 76.41 ops/sec ±2.72% (66 runs sampled)\n      astring x 483 ops/sec ±2.03% (78 runs sampled)\n      babel x 59.58 ops/sec ±0.89% (62 runs sampled)\n\n    Generating code with source maps for an AST from jquery.js by...\n      escodegen x 7.95 ops/sec ±1.87% (24 runs sampled)\n      astring x 158 ops/sec ±1.18% (79 runs sampled)\n      babel x 35.48 ops/sec ±1.20% (62 runs sampled)\n\n## Exported Parser Size\n\n    ❯ package-size esprima acorn @babel/parser hermes meriyah seafox kataw \\\n        cherow @azariasb/escaya tenko tree-sitter tree-sitter-javascript\n\n    package                        size       minified   gzipped\n    esprima@4.0.1                  278.47 KB  132.14 KB  28.59 KB\n    acorn@8.12.1                   221.78 KB  113.71 KB  32.74 KB\n    @babel/parser@7.24.8           476.68 KB  282.87 KB  73.59 KB\n    hermes@0.4.4                   308.87 KB  53.94 KB   17.98 KB\n    meriyah@4.3.0                  128.94 KB  127.33 KB  40.25 KB\n    seafox@1.7.1                   95 KB      93.41 KB   25.57 KB\n    kataw@0.0.81                   297.65 KB  291.29 KB  59.47 KB\n    cherow@1.6.9                   300.63 KB  89.85 KB   25.12 KB\n    @azariasb/escaya@0.0.63        98.24 KB   96.53 KB   25.97 KB\n    tenko@2.0.1                    371.71 KB  142.41 KB  39.75 KB\n    tree-sitter@0.20.0             51.28 KB   22.81 KB   6.8 KB\n    tree-sitter-javascript@0.21.4  65.3 KB    40.06 KB   5.83 KB\n\nComputing the package sizes may need `NODE_OPTIONS=--openssl-legacy-provider` depending on the state of `crypto` in your JavaScript VM. I had to keep `meriyah` and `tree-sitter` sizes from the previous update, because `package-size` wasn't able to compile their modern code.\n\nThe `tree-sitter` parser uses native libraries, which have to considered too, when computing the package size:\n\n    ❯ node perf/tree-sitter-size.js\n\n    tree-sitter:             395.30 KB\n    tree-sitter-javascript:  389.42 KB\n\n## Exported Code Generator Size\n\n    ❯ package-size escodegen astring\n\n    package          size       minified  gzipped\n    escodegen@2.1.0  279.28 KB  97.02 KB  25.68 KB\n    astring@1.8.6    36.07 KB   15.57 KB  4.32 KB\n\nEstimating the size of `@babel/generator` failed with webpack compilation errors.\n\n## Contributing\n\nIn lieu of a formal styleguide, take care to maintain the existing coding style. Lint and test your code.\n\n## License\n\nCopyright (c) 2022-2024 Ferdinand Prantl\n\nLicensed under the MIT license.\n","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprantlf%2Fecmascript-parser-benchmark","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprantlf%2Fecmascript-parser-benchmark","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprantlf%2Fecmascript-parser-benchmark/lists"}