Skip to content

Benchmarks

Generated by scripts/generate_benchmarks_doc.py. Re-run to refresh after new benchmark runs.

This document compares Galley (the generated LL/LR parser in this repository) against widely-used third-party parsers and parser-generators on the current benchmark inputs.

Unless noted otherwise, results were recorded on an Apple M1 Pro.


Bundled Grammar Coverage

Galley benchmarks are meant to show both parser throughput and grammar breadth. JSON is the head-to-head comparison target because mature third-party parsers exist for it; Lisp, Lua, and the grammar parser exercise different language shapes and should not be read as direct comparisons against JSON.

GrammarWhat it exercisesParsers
JSONRecursive data, strings, numbers, arrays, objects, third-party comparison baselineLL + LR
LispNested S-expressions, symbols, strings, integers, multiple top-level formsLL
LuaKeyword-led statements, functions, calls, returns, keyed table constructorsLL
Galley GrammarThe .grm language used to define Galley grammarsLL + LR

JSON Parsing — Throughput Comparison

What are we comparing?

The parsers below fall into two distinct categories:

General-purpose parser generators / tools — you describe a grammar and the tool produces a parser for any language matching that grammar. Bison, LALRPOP, Nom, and Tree-sitter all belong here. Galley is in this category.

Specialised JSON libraries — simdjson and RapidJSON are hand-written C++ libraries optimised exclusively for JSON. They exploit structural properties unique to JSON (bracket nesting depth limits, ASCII-range tokens, predictable whitespace patterns) with SIMD intrinsics and two-pass parsing that is not generalisable to arbitrary grammars. They are reference points showing what a single-purpose native implementation can achieve, not direct competitors to a parser generator.

Within the parser-generator category, Galley LL is 3.5× faster than LALRPOP (Rust), 5.2× faster than Bison/Flex (C), and 6.6× faster than Nom (Rust) — with full AST construction still outpacing LALRPOP's non-AST mode.

Notably, Galley's no-ast throughput of 717 MB/s is within ~8% of RapidJSON's SAX mode (666 MB/s) — a hand-tuned C++ library with SIMD acceleration — despite Galley being a general-purpose parser generated from a grammar specification with no JSON-specific optimisations.

Parser Generators & Tools — Head-to-Head

Galley is measured with the fastest 2^16 input-size configuration. Third-party tools run on third_party/parser-benchmark/large_dataset.json (~50 MB). Inputs differ; this is a directional comparison.

Parser / ModeCategoryThroughput
Galley LL (no-ast)Galley (generated)716.9 MB/s
Galley LL (with-ast)Galley (generated)463.5 MB/s
Galley LR (no-ast)Galley (generated)301.9 MB/s
LALRPOP (Rust) — Non-ASTLALRPOP (Rust)206.4 MB/s
Bison / Flex — Non-ASTBison / Flex137.1 MB/s
Bison / Flex — Simple ASTBison / Flex133.1 MB/s
Bison / Flex — Adv ASTBison / Flex130.5 MB/s
Bison / Flex — Payload ASTBison / Flex130.2 MB/s
Nom (Rust) — ASTNom (Rust)108.9 MB/s
Galley LR (with-ast)Galley (generated)107.5 MB/s
Tree-sitter (C) — CSTTree-sitter (C)19.3 MB/s
  Galley LL  (no-ast)         ████████████████████████████████████████     716.9 MB/s
  Galley LL  (with-ast)       █████████████████████████░░░░░░░░░░░░░░░     463.5 MB/s
  Galley LR  (no-ast)         ████████████████░░░░░░░░░░░░░░░░░░░░░░░░     301.9 MB/s
  LALRPOP (Rust) — Non-AST    ███████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░     206.4 MB/s
  Bison / Flex — Non-AST      ███████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░     137.1 MB/s
  Bison / Flex — Simple AST   ███████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░     133.1 MB/s
  Bison / Flex — Adv AST      ███████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░     130.5 MB/s
  Bison / Flex — Payload AST  ███████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░     130.2 MB/s
  Nom (Rust) — AST            ██████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░     108.9 MB/s
  Galley LR  (with-ast)       █████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░     107.5 MB/s
  Tree-sitter (C) — CST       █░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░      19.3 MB/s

Specialised JSON Libraries — For Reference

These libraries are optimised exclusively for JSON using SIMD intrinsics and two-pass structural parsing. They are included as an upper-bound reference for single-purpose native JSON parsing performance.

Library — ModeThroughput
simdjson (C++) — Validate2,739 MB/s
simdjson (C++) — DOM (AST)1,496 MB/s
RapidJSON (C++ / SIMD) — SAX (Validate)665.5 MB/s
RapidJSON (C++ / SIMD) — DOM (AST)501.8 MB/s
  simdjson (C++) — Validate                ████████████████████████████████████████    2738.5 MB/s
  simdjson (C++) — DOM (AST)               █████████████████████░░░░░░░░░░░░░░░░░░░    1496.4 MB/s
  RapidJSON (C++ / SIMD) — SAX (Validate)  █████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░     665.5 MB/s
  RapidJSON (C++ / SIMD) — DOM (AST)       ███████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░     501.8 MB/s

Lua

A Lua grammar that exercises keyword-led statements, function declarations, returns, function-call expressions, integer literals, strings, comments, and keyed table constructors.

AST = build syntax tree · Term. = include terminal nodes in tree · Limit = token size limit

languages/lua/samples/code-01.lua

ASTTerm.LimitLLLRLL/LR
16283.0 MB/s
32194.8 MB/s
1673.1 MB/s
16100.1 MB/s
3274.6 MB/s
32102.3 MB/s
  LL  ✗ast ✗term lim=16  ████████████████████████████████████████     283.0 MB/s
  LL  ✗ast ✗term lim=32  ███████████████████████████░░░░░░░░░░░░░     194.8 MB/s
  LL  ✓ast ✗term lim=32  ██████████████░░░░░░░░░░░░░░░░░░░░░░░░░░     102.3 MB/s
  LL  ✓ast ✗term lim=16  ██████████████░░░░░░░░░░░░░░░░░░░░░░░░░░     100.1 MB/s
  LL  ✓ast ✓term lim=32  ██████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░      74.6 MB/s
  LL  ✓ast ✓term lim=16  ██████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░      73.1 MB/s
  LR  ✗ast ✗term lim=16  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░       0.0 MB/s
  LR  ✗ast ✗term lim=32  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░       0.0 MB/s
  LR  ✓ast ✓term lim=16  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░       0.0 MB/s
  LR  ✓ast ✗term lim=16  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░       0.0 MB/s
  LR  ✓ast ✓term lim=32  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░       0.0 MB/s
  LR  ✓ast ✗term lim=32  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░       0.0 MB/s

languages/lua/samples/code-02.lua

ASTTerm.LimitLLLRLL/LR
16322.1 MB/s
32237.6 MB/s
1684.4 MB/s
16114.1 MB/s
3280.6 MB/s
32108.7 MB/s
  LL  ✗ast ✗term lim=16  ████████████████████████████████████████     322.1 MB/s
  LL  ✗ast ✗term lim=32  █████████████████████████████░░░░░░░░░░░     237.6 MB/s
  LL  ✓ast ✗term lim=16  ██████████████░░░░░░░░░░░░░░░░░░░░░░░░░░     114.1 MB/s
  LL  ✓ast ✗term lim=32  █████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░     108.7 MB/s
  LL  ✓ast ✓term lim=16  ██████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░      84.4 MB/s
  LL  ✓ast ✓term lim=32  ██████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░      80.6 MB/s
  LR  ✗ast ✗term lim=16  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░       0.0 MB/s
  LR  ✗ast ✗term lim=32  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░       0.0 MB/s
  LR  ✓ast ✓term lim=16  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░       0.0 MB/s
  LR  ✓ast ✗term lim=16  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░       0.0 MB/s
  LR  ✓ast ✓term lim=32  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░       0.0 MB/s
  LR  ✓ast ✗term lim=32  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░       0.0 MB/s

Lisp

A Lisp grammar that exercises lists, symbols, numbers, strings, reader macros, comments, vectors, arrays, and multiple top-level forms.

AST = build syntax tree · Term. = include terminal nodes in tree · Limit = token size limit

languages/lisp/samples/code-01.lisp

ASTTerm.LimitLLLRLL/LR
16396.3 MB/s
32383.1 MB/s
16201.6 MB/s
16229.4 MB/s
32185.1 MB/s
32221.1 MB/s
  LL  ✗ast ✗term lim=16  ████████████████████████████████████████     396.3 MB/s
  LL  ✗ast ✗term lim=32  ██████████████████████████████████████░░     383.1 MB/s
  LL  ✓ast ✗term lim=16  ███████████████████████░░░░░░░░░░░░░░░░░     229.4 MB/s
  LL  ✓ast ✗term lim=32  ██████████████████████░░░░░░░░░░░░░░░░░░     221.1 MB/s
  LL  ✓ast ✓term lim=16  ████████████████████░░░░░░░░░░░░░░░░░░░░     201.6 MB/s
  LL  ✓ast ✓term lim=32  ██████████████████░░░░░░░░░░░░░░░░░░░░░░     185.1 MB/s
  LR  ✗ast ✗term lim=16  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░       0.0 MB/s
  LR  ✗ast ✗term lim=32  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░       0.0 MB/s
  LR  ✓ast ✓term lim=16  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░       0.0 MB/s
  LR  ✓ast ✗term lim=16  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░       0.0 MB/s
  LR  ✓ast ✓term lim=32  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░       0.0 MB/s
  LR  ✓ast ✗term lim=32  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░       0.0 MB/s

languages/lisp/samples/code-02.lisp

ASTTerm.LimitLLLRLL/LR
16424.1 MB/s
32405.1 MB/s
16237.5 MB/s
16262.3 MB/s
32220.6 MB/s
32245.4 MB/s
  LL  ✗ast ✗term lim=16  ████████████████████████████████████████     424.1 MB/s
  LL  ✗ast ✗term lim=32  ██████████████████████████████████████░░     405.1 MB/s
  LL  ✓ast ✗term lim=16  ████████████████████████░░░░░░░░░░░░░░░░     262.3 MB/s
  LL  ✓ast ✗term lim=32  ███████████████████████░░░░░░░░░░░░░░░░░     245.4 MB/s
  LL  ✓ast ✓term lim=16  ██████████████████████░░░░░░░░░░░░░░░░░░     237.5 MB/s
  LL  ✓ast ✓term lim=32  ████████████████████░░░░░░░░░░░░░░░░░░░░     220.6 MB/s
  LR  ✗ast ✗term lim=16  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░       0.0 MB/s
  LR  ✗ast ✗term lim=32  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░       0.0 MB/s
  LR  ✓ast ✓term lim=16  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░       0.0 MB/s
  LR  ✓ast ✗term lim=16  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░       0.0 MB/s
  LR  ✓ast ✓term lim=32  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░       0.0 MB/s
  LR  ✓ast ✗term lim=32  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░       0.0 MB/s

JSON

Standard JSON (RFC 8259). This is the benchmark JSON grammar: it parses full recursive JSON while keeping the grammar factored with few non-terminals for maximum generated parser throughput.

AST = build syntax tree · Term. = include terminal nodes in tree · Limit = token size limit

languages/json/samples/code-01.json

ASTTerm.LimitLLLRLL/LR
16716.9 MB/s301.9 MB/s2.38×
32611.6 MB/s238.5 MB/s2.56×
16317.4 MB/s91.4 MB/s3.47×
16463.5 MB/s107.5 MB/s4.31×
32304.2 MB/s87.1 MB/s3.49×
32429.4 MB/s106.9 MB/s4.02×
  LL  ✗ast ✗term lim=16  ████████████████████████████████████████     716.9 MB/s
  LL  ✗ast ✗term lim=32  ██████████████████████████████████░░░░░░     611.6 MB/s
  LL  ✓ast ✗term lim=16  █████████████████████████░░░░░░░░░░░░░░░     463.5 MB/s
  LL  ✓ast ✗term lim=32  ███████████████████████░░░░░░░░░░░░░░░░░     429.4 MB/s
  LL  ✓ast ✓term lim=16  █████████████████░░░░░░░░░░░░░░░░░░░░░░░     317.4 MB/s
  LL  ✓ast ✓term lim=32  ████████████████░░░░░░░░░░░░░░░░░░░░░░░░     304.2 MB/s
  LR  ✗ast ✗term lim=16  ████████████████░░░░░░░░░░░░░░░░░░░░░░░░     301.9 MB/s
  LR  ✗ast ✗term lim=32  █████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░     238.5 MB/s
  LR  ✓ast ✗term lim=16  █████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░     107.5 MB/s
  LR  ✓ast ✗term lim=32  █████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░     106.9 MB/s
  LR  ✓ast ✓term lim=16  █████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░      91.4 MB/s
  LR  ✓ast ✓term lim=32  ████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░      87.1 MB/s

languages/json/samples/code-02.json

ASTTerm.LimitLLLRLL/LR
32273.3 MB/s89.8 MB/s3.04×
32374.4 MB/s107.4 MB/s3.49×
  LL  ✓ast ✗term lim=32  ████████████████████████████████████████     374.4 MB/s
  LL  ✓ast ✓term lim=32  █████████████████████████████░░░░░░░░░░░     273.3 MB/s
  LR  ✓ast ✗term lim=32  ███████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░     107.4 MB/s
  LR  ✓ast ✓term lim=32  █████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░      89.8 MB/s

Galley

Galley's own grammar file format (.grm). This is the self-hosting grammar: Galley uses itself to parse the grammar files that define its languages, including this one. Exercises nested rules, procedure annotations, comment syntax, and indentation-sensitive constructs.

AST = build syntax tree · Term. = include terminal nodes in tree · Limit = token size limit

languages/galley/ll.grm

ASTTerm.LimitLLLRLL/LR
16555.2 MB/s179.3 MB/s3.10×
32474.7 MB/s164.8 MB/s2.88×
1690.0 MB/s57.8 MB/s1.56×
16126.4 MB/s72.7 MB/s1.74×
3283.3 MB/s56.2 MB/s1.48×
32128.0 MB/s71.0 MB/s1.80×
  LL  ✗ast ✗term lim=16  ████████████████████████████████████████     555.2 MB/s
  LL  ✗ast ✗term lim=32  ██████████████████████████████████░░░░░░     474.7 MB/s
  LR  ✗ast ✗term lim=16  ████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░     179.3 MB/s
  LR  ✗ast ✗term lim=32  ███████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░     164.8 MB/s
  LL  ✓ast ✗term lim=32  █████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░     128.0 MB/s
  LL  ✓ast ✗term lim=16  █████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░     126.4 MB/s
  LL  ✓ast ✓term lim=16  ██████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░      90.0 MB/s
  LL  ✓ast ✓term lim=32  ██████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░      83.3 MB/s
  LR  ✓ast ✗term lim=16  █████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░      72.7 MB/s
  LR  ✓ast ✗term lim=32  █████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░      71.0 MB/s
  LR  ✓ast ✓term lim=16  ████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░      57.8 MB/s
  LR  ✓ast ✓term lim=32  ████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░      56.2 MB/s

languages/galley/lr.grm

ASTTerm.LimitLLLRLL/LR
16552.4 MB/s179.8 MB/s3.07×
32473.1 MB/s165.4 MB/s2.86×
1689.0 MB/s56.8 MB/s1.57×
16125.8 MB/s72.2 MB/s1.74×
3284.3 MB/s56.0 MB/s1.51×
32127.0 MB/s70.7 MB/s1.80×
  LL  ✗ast ✗term lim=16  ████████████████████████████████████████     552.4 MB/s
  LL  ✗ast ✗term lim=32  ██████████████████████████████████░░░░░░     473.1 MB/s
  LR  ✗ast ✗term lim=16  █████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░     179.8 MB/s
  LR  ✗ast ✗term lim=32  ███████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░     165.4 MB/s
  LL  ✓ast ✗term lim=32  █████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░     127.0 MB/s
  LL  ✓ast ✗term lim=16  █████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░     125.8 MB/s
  LL  ✓ast ✓term lim=16  ██████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░      89.0 MB/s
  LL  ✓ast ✓term lim=32  ██████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░      84.3 MB/s
  LR  ✓ast ✗term lim=16  █████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░      72.2 MB/s
  LR  ✓ast ✗term lim=32  █████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░      70.7 MB/s
  LR  ✓ast ✓term lim=16  ████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░      56.8 MB/s
  LR  ✓ast ✓term lim=32  ████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░      56.0 MB/s

languages/json/ll.grm

ASTTerm.LimitLLLRLL/LR
16540.3 MB/s210.7 MB/s2.57×
32446.7 MB/s180.9 MB/s2.47×
1691.2 MB/s60.1 MB/s1.52×
16129.2 MB/s76.5 MB/s1.69×
3289.6 MB/s60.0 MB/s1.49×
32129.0 MB/s75.1 MB/s1.72×
  LL  ✗ast ✗term lim=16  ████████████████████████████████████████     540.3 MB/s
  LL  ✗ast ✗term lim=32  █████████████████████████████████░░░░░░░     446.7 MB/s
  LR  ✗ast ✗term lim=16  ███████████████░░░░░░░░░░░░░░░░░░░░░░░░░     210.7 MB/s
  LR  ✗ast ✗term lim=32  █████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░     180.9 MB/s
  LL  ✓ast ✗term lim=16  █████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░     129.2 MB/s
  LL  ✓ast ✗term lim=32  █████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░     129.0 MB/s
  LL  ✓ast ✓term lim=16  ██████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░      91.2 MB/s
  LL  ✓ast ✓term lim=32  ██████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░      89.6 MB/s
  LR  ✓ast ✗term lim=16  █████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░      76.5 MB/s
  LR  ✓ast ✗term lim=32  █████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░      75.1 MB/s
  LR  ✓ast ✓term lim=16  ████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░      60.1 MB/s
  LR  ✓ast ✓term lim=32  ████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░      60.0 MB/s

languages/sanbus/ll.grm

ASTTerm.LimitLLLRLL/LR
16539.3 MB/s181.6 MB/s2.97×
32451.6 MB/s166.8 MB/s2.71×
1683.0 MB/s56.4 MB/s1.47×
16122.7 MB/s72.7 MB/s1.69×
3277.7 MB/s54.6 MB/s1.42×
32113.9 MB/s68.6 MB/s1.66×
  LL  ✗ast ✗term lim=16  ████████████████████████████████████████     539.3 MB/s
  LL  ✗ast ✗term lim=32  █████████████████████████████████░░░░░░░     451.6 MB/s
  LR  ✗ast ✗term lim=16  █████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░     181.6 MB/s
  LR  ✗ast ✗term lim=32  ████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░     166.8 MB/s
  LL  ✓ast ✗term lim=16  █████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░     122.7 MB/s
  LL  ✓ast ✗term lim=32  ████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░     113.9 MB/s
  LL  ✓ast ✓term lim=16  ██████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░      83.0 MB/s
  LL  ✓ast ✓term lim=32  █████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░      77.7 MB/s
  LR  ✓ast ✗term lim=16  █████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░      72.7 MB/s
  LR  ✓ast ✗term lim=32  █████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░      68.6 MB/s
  LR  ✓ast ✓term lim=16  ████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░      56.4 MB/s
  LR  ✓ast ✓term lim=32  ████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░      54.6 MB/s

languages/ll1/ll.grm

ASTTerm.LimitLLLRLL/LR
16534.3 MB/s181.6 MB/s2.94×
32450.7 MB/s166.3 MB/s2.71×
1683.4 MB/s56.4 MB/s1.48×
16121.9 MB/s72.6 MB/s1.68×
3277.7 MB/s54.7 MB/s1.42×
32111.8 MB/s68.5 MB/s1.63×
  LL  ✗ast ✗term lim=16  ████████████████████████████████████████     534.3 MB/s
  LL  ✗ast ✗term lim=32  █████████████████████████████████░░░░░░░     450.7 MB/s
  LR  ✗ast ✗term lim=16  █████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░     181.6 MB/s
  LR  ✗ast ✗term lim=32  ████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░     166.3 MB/s
  LL  ✓ast ✗term lim=16  █████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░     121.9 MB/s
  LL  ✓ast ✗term lim=32  ████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░     111.8 MB/s
  LL  ✓ast ✓term lim=16  ██████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░      83.4 MB/s
  LL  ✓ast ✓term lim=32  █████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░      77.7 MB/s
  LR  ✓ast ✗term lim=16  █████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░      72.6 MB/s
  LR  ✓ast ✗term lim=32  █████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░      68.5 MB/s
  LR  ✓ast ✓term lim=16  ████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░      56.4 MB/s
  LR  ✓ast ✓term lim=32  ████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░      54.7 MB/s

JSON Augmented

JSON extended with a custom prefix notation: *value and (expr) wrappers. Demonstrates how a standard grammar can be incrementally extended with new syntax without touching the original JSON rules — an LL-only grammar due to prefix ambiguity.

AST = build syntax tree · Term. = include terminal nodes in tree · Limit = token size limit

languages/json-augmented/samples/code-01-small.json

ASTTerm.LimitLLLRLL/LR
16653.4 MB/s
32520.9 MB/s
16257.8 MB/s
16360.2 MB/s
32261.1 MB/s
32363.5 MB/s
  LL  ✗ast ✗term lim=16  ████████████████████████████████████████     653.4 MB/s
  LL  ✗ast ✗term lim=32  ███████████████████████████████░░░░░░░░░     520.9 MB/s
  LL  ✓ast ✗term lim=32  ██████████████████████░░░░░░░░░░░░░░░░░░     363.5 MB/s
  LL  ✓ast ✗term lim=16  ██████████████████████░░░░░░░░░░░░░░░░░░     360.2 MB/s
  LL  ✓ast ✓term lim=32  ███████████████░░░░░░░░░░░░░░░░░░░░░░░░░     261.1 MB/s
  LL  ✓ast ✓term lim=16  ███████████████░░░░░░░░░░░░░░░░░░░░░░░░░     257.8 MB/s
  LR  ✗ast ✗term lim=16  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░       0.0 MB/s
  LR  ✗ast ✗term lim=32  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░       0.0 MB/s
  LR  ✓ast ✓term lim=16  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░       0.0 MB/s
  LR  ✓ast ✗term lim=16  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░       0.0 MB/s
  LR  ✓ast ✓term lim=32  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░       0.0 MB/s
  LR  ✓ast ✗term lim=32  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░       0.0 MB/s

languages/json-augmented/samples/code-02-recursive-stress.json

ASTTerm.LimitLLLRLL/LR
32361.8 MB/s
32438.2 MB/s
  LL  ✓ast ✗term lim=32  ████████████████████████████████████████     438.2 MB/s
  LL  ✓ast ✓term lim=32  █████████████████████████████████░░░░░░░     361.8 MB/s
  LR  ✓ast ✓term lim=32  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░       0.0 MB/s
  LR  ✓ast ✗term lim=32  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░       0.0 MB/s

languages/json-augmented/samples/code-03.json

ASTTerm.LimitLLLRLL/LR
16695.1 MB/s
32590.8 MB/s
16655.5 MB/s
16670.0 MB/s
32580.5 MB/s
32586.5 MB/s
  LL  ✗ast ✗term lim=16  ████████████████████████████████████████     695.1 MB/s
  LL  ✓ast ✗term lim=16  ██████████████████████████████████████░░     670.0 MB/s
  LL  ✓ast ✓term lim=16  █████████████████████████████████████░░░     655.5 MB/s
  LL  ✗ast ✗term lim=32  ██████████████████████████████████░░░░░░     590.8 MB/s
  LL  ✓ast ✗term lim=32  █████████████████████████████████░░░░░░░     586.5 MB/s
  LL  ✓ast ✓term lim=32  █████████████████████████████████░░░░░░░     580.5 MB/s
  LR  ✗ast ✗term lim=16  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░       0.0 MB/s
  LR  ✗ast ✗term lim=32  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░       0.0 MB/s
  LR  ✓ast ✓term lim=16  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░       0.0 MB/s
  LR  ✓ast ✗term lim=16  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░       0.0 MB/s
  LR  ✓ast ✓term lim=32  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░       0.0 MB/s
  LR  ✓ast ✗term lim=32  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░       0.0 MB/s

languages/json-augmented/samples/code-04.json

ASTTerm.LimitLLLRLL/LR
32574.5 MB/s
32571.4 MB/s
  LL  ✓ast ✓term lim=32  ████████████████████████████████████████     574.5 MB/s
  LL  ✓ast ✗term lim=32  ███████████████████████████████████████░     571.4 MB/s
  LR  ✓ast ✓term lim=32  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░       0.0 MB/s
  LR  ✓ast ✗term lim=32  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░       0.0 MB/s

languages/json/samples/code-01.json

ASTTerm.LimitLLLRLL/LR
16705.7 MB/s
32589.8 MB/s
16658.7 MB/s
16671.5 MB/s
32580.7 MB/s
32590.1 MB/s
  LL  ✗ast ✗term lim=16  ████████████████████████████████████████     705.7 MB/s
  LL  ✓ast ✗term lim=16  ██████████████████████████████████████░░     671.5 MB/s
  LL  ✓ast ✓term lim=16  █████████████████████████████████████░░░     658.7 MB/s
  LL  ✓ast ✗term lim=32  █████████████████████████████████░░░░░░░     590.1 MB/s
  LL  ✗ast ✗term lim=32  █████████████████████████████████░░░░░░░     589.8 MB/s
  LL  ✓ast ✓term lim=32  ████████████████████████████████░░░░░░░░     580.7 MB/s
  LR  ✗ast ✗term lim=16  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░       0.0 MB/s
  LR  ✗ast ✗term lim=32  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░       0.0 MB/s
  LR  ✓ast ✓term lim=16  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░       0.0 MB/s
  LR  ✓ast ✗term lim=16  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░       0.0 MB/s
  LR  ✓ast ✓term lim=32  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░       0.0 MB/s
  LR  ✓ast ✗term lim=32  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░       0.0 MB/s

languages/json/samples/code-02.json

ASTTerm.LimitLLLRLL/LR
32574.0 MB/s
32571.6 MB/s
  LL  ✓ast ✓term lim=32  ████████████████████████████████████████     574.0 MB/s
  LL  ✓ast ✗term lim=32  ███████████████████████████████████████░     571.6 MB/s
  LR  ✓ast ✓term lim=32  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░       0.0 MB/s
  LR  ✓ast ✗term lim=32  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░       0.0 MB/s

JSON with Structured AST

A full JSON grammar with extra intermediate non-terminals for a more structured AST shape. It is useful when tree shape matters more than headline throughput.

AST = build syntax tree · Term. = include terminal nodes in tree · Limit = token size limit

languages/json/samples/code-01.json

ASTTerm.LimitLLLRLL/LR
16662.4 MB/s276.6 MB/s2.40×
32592.6 MB/s207.9 MB/s2.85×
16380.3 MB/s74.1 MB/s5.13×
16491.2 MB/s87.3 MB/s5.63×
32371.2 MB/s72.3 MB/s5.13×
32480.1 MB/s84.2 MB/s5.70×
  LL  ✗ast ✗term lim=16  ████████████████████████████████████████     662.4 MB/s
  LL  ✗ast ✗term lim=32  ███████████████████████████████████░░░░░     592.6 MB/s
  LL  ✓ast ✗term lim=16  █████████████████████████████░░░░░░░░░░░     491.2 MB/s
  LL  ✓ast ✗term lim=32  ████████████████████████████░░░░░░░░░░░░     480.1 MB/s
  LL  ✓ast ✓term lim=16  ██████████████████████░░░░░░░░░░░░░░░░░░     380.3 MB/s
  LL  ✓ast ✓term lim=32  ██████████████████████░░░░░░░░░░░░░░░░░░     371.2 MB/s
  LR  ✗ast ✗term lim=16  ████████████████░░░░░░░░░░░░░░░░░░░░░░░░     276.6 MB/s
  LR  ✗ast ✗term lim=32  ████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░     207.9 MB/s
  LR  ✓ast ✗term lim=16  █████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░      87.3 MB/s
  LR  ✓ast ✗term lim=32  █████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░      84.2 MB/s
  LR  ✓ast ✓term lim=16  ████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░      74.1 MB/s
  LR  ✓ast ✓term lim=32  ████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░      72.3 MB/s

languages/json/samples/code-02.json

ASTTerm.LimitLLLRLL/LR
32328.6 MB/s70.8 MB/s4.64×
32410.4 MB/s83.2 MB/s4.94×
  LL  ✓ast ✗term lim=32  ████████████████████████████████████████     410.4 MB/s
  LL  ✓ast ✓term lim=32  ████████████████████████████████░░░░░░░░     328.6 MB/s
  LR  ✓ast ✗term lim=32  ████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░      83.2 MB/s
  LR  ✓ast ✓term lim=32  ██████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░      70.8 MB/s

Sanbus

An indentation-sensitive structured data/schema language with declarations and embedded state, action, and effect logic. It exercises both LL and LR parsing together with semantic reduction procedures.

AST = build syntax tree · Term. = include terminal nodes in tree · Limit = token size limit

languages/sanbus/samples/code-01

ASTTerm.LimitLLLRLL/LR
16177.6 MB/s
32178.3 MB/s
1680.3 MB/s
1699.3 MB/s
3278.4 MB/s
3283.2 MB/s
  LL  ✗ast ✗term lim=32  ████████████████████████████████████████     178.3 MB/s
  LL  ✗ast ✗term lim=16  ███████████████████████████████████████░     177.6 MB/s
  LL  ✓ast ✗term lim=16  ██████████████████████░░░░░░░░░░░░░░░░░░      99.3 MB/s
  LL  ✓ast ✗term lim=32  ██████████████████░░░░░░░░░░░░░░░░░░░░░░      83.2 MB/s
  LL  ✓ast ✓term lim=16  ██████████████████░░░░░░░░░░░░░░░░░░░░░░      80.3 MB/s
  LL  ✓ast ✓term lim=32  █████████████████░░░░░░░░░░░░░░░░░░░░░░░      78.4 MB/s
  LR  ✗ast ✗term lim=16  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░       0.0 MB/s
  LR  ✗ast ✗term lim=32  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░       0.0 MB/s
  LR  ✓ast ✓term lim=16  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░       0.0 MB/s
  LR  ✓ast ✗term lim=16  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░       0.0 MB/s
  LR  ✓ast ✓term lim=32  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░       0.0 MB/s
  LR  ✓ast ✗term lim=32  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░       0.0 MB/s

languages/sanbus/samples/code-02

ASTTerm.LimitLLLRLL/LR
32229.1 MB/s
3279.2 MB/s
3289.8 MB/s
  LL  ✗ast ✗term lim=32  ████████████████████████████████████████     229.1 MB/s
  LL  ✓ast ✗term lim=32  ███████████████░░░░░░░░░░░░░░░░░░░░░░░░░      89.8 MB/s
  LL  ✓ast ✓term lim=32  █████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░      79.2 MB/s
  LR  ✗ast ✗term lim=32  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░       0.0 MB/s
  LR  ✓ast ✓term lim=32  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░       0.0 MB/s
  LR  ✓ast ✗term lim=32  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░       0.0 MB/s

LL(1)

A procedure-free indentation-sensitive grammar whose delimiter tokens make every decision point unambiguous with one token of lookahead. Used to exercise and benchmark the LL(1) fast path.

AST = build syntax tree · Term. = include terminal nodes in tree · Limit = token size limit

languages/ll1/samples/code-01

ASTTerm.LimitLLLRLL/LR
32244.9 MB/s
3282.2 MB/s
3291.2 MB/s
  LL  ✗ast ✗term lim=32  ███████████████████████████████████████░     244.9 MB/s
  LL  ✓ast ✗term lim=32  ██████████████░░░░░░░░░░░░░░░░░░░░░░░░░░      91.2 MB/s
  LL  ✓ast ✓term lim=32  █████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░      82.2 MB/s
  LR  ✗ast ✗term lim=32  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░       0.0 MB/s
  LR  ✓ast ✓term lim=32  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░       0.0 MB/s
  LR  ✓ast ✗term lim=32  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░       0.0 MB/s

Methodology

Galley (this compiler)

  • Benchmarks are run by scripts/benchmark.py.
  • Each result file lives under benchmark_results/galley/{grammar}/{ast_mode}/{size_limit}/{terminal_ast}/{input_lang}/{input_file}.txt.
  • Parsed bytes reflects repeated parsing of the input until a stable total is reached.
  • LL = generated LL parser; LR = generated LR parser.

Third-party parsers

  • Benchmarks are run by third_party/parser-benchmark/ (Zig project).
  • Results are written to benchmark_results/third_party/json/{input_file}.txt.
  • Input: large_dataset.json (~50 MB synthetic JSON array).
  • Parsers included: Tree-sitter (C, CST), Bison/Flex (C, multiple AST modes), LALRPOP (Rust, Non-AST), simdjson (C++, Validate & DOM), Nom (Rust, AST), RapidJSON (C++/SIMD, DOM & SAX).

Environment

Results will vary by machine. All numbers are from a single run on an Apple M1 Pro.