JSON Schema validators, regex engines and dictionary automata, measured on one machine

A benchmark report from schemaBench

2026-11-21


This report backs the performance claims in Project Delphi: From Definition to Execution: Fast JSON Schema Validation. It covers three tracks, all measured in-process on one machine with one harness:

  • Track A, JSON Schema validators (the main result). Oracle’s jznschema engine, in two backends, against MongoDB’s real $jsonSchema engine, Blaze, jsonschema-rs, pg_jsonschema, boon and AJV.
  • Track B, regex engines. hotdawg-regex, the derivative-automaton engine jznschema uses for pattern, against the Rust regex crate, fancy-regex, PCRE2, RE2 and V8.
  • Track C, dictionary search. hotdawg’s DAWG term dictionary against fst, tantivy-fst, Lucene 10 and a naive scan.

jznschema and hotdawg are the work of Patrick Meredith, who wrote both engines. schemaBench consumes them at pinned revisions; it does not modify them.

The goal is a reproducible, like-for-like comparison of software components. It is not a comparison of database products. Every number below is recomputed from the result files in results/.

Executive Summary

  • Oracle jznschema vs MongoDB $jsonSchema: 18.4× geomean over the 71 Tier-1 cases both answer correctly, and Oracle is faster on all 71 (interpreted backend). Without the two cases whose MongoDB time is set by its regex match limit, it is 14.6×. The compiled backend is 53.3×.
  • Against the fastest other engine on each case, the compiled backend is 4.33× faster (wins 141 of 160). The interpreted backend is 1.11× (wins 92 of 160): it is not always the fastest. Blaze beats it on 51 of 158 shared cases, jsonschema-rs on 41.
  • Regex-heavy schemas are roughly level. On the 24 regex_* cases the interpreted backend is 0.98× of the fastest other validator (wins 12/24) and the compiled backend 1.07× (wins 13/24). Blaze and jsonschema-rs are faster on uuid,items_pattern and lazy_dfa.
  • MongoDB prepares a schema fastest. Median preparation time per schema, in a fresh process: MongoDB 56 µs, Oracle 150 µs, Blaze 182 µs, jsonschema-rs 868 µs, boon 1.51 ms, AJV 25.9 ms. Oracle’s slowest preparation is 12.5 ms (wide_late_any_of), where MongoDB takes 0.71 ms.
  • A regex match limit turned into a wrong answer. On a valid document, MongoDB and Blaze report invalid when PCRE2’s match limit fires. The automaton engines answer correctly in 25–51 ns. AJV answers correctly but takes 31 ms per document.
  • Track B: hotdawg-lazy is level with the Rust regex crate on everyday patterns (1.02–1.03×) and 1.6–7.4× ahead of the backtracking engines and RE2. It loses to its own DenseMatcher (0.72–0.94×) and, clearly, on the state-explosion case a[ab]{20}c: 7.5 ms vs 94 ns for PCRE2.
  • Track C: hotdawg is 1.07–3.8× faster than fst, tantivy-fst and Lucene’s FST on lookup, prefix, regex and fuzzy search. Lucene’s BlockTree terms dictionary beats it on regex (0.78×). hotdawg’s structure is 3.0–5.5× larger, builds 3.3× slower than fst, and opens in 0.94–1.7 ms against about 50 ns.
  • The harness was checked against the engine authors’ own. Our timings are within 0.98–0.99× of jznschema’s own benchmark for jznschema, jsonschema-rs and boon, and two full runs agree per engine within ±1.1%. Not measured yet: memory, throughput under concurrent load, compatibility-check (schema-vs-schema) performance, and detailed-error-report mode.

What the article asks of a benchmark, and the evidence

The article’s section Show the cost of checking every order sets out what good measurements must show. This table maps each point to what schemaBench measured, and says where the evidence stops.

The article asks forWhat we measuredGaps
Preparation reported separately from repeated checksPreparation (nsCompileMedian): median time to prepare each schema once, in a fresh driver process, per case and engine. Repeated checks: time per document with an already-prepared validator. Shown side by side in The cost of checking every order and in a separate table.The compiled backend is prepared ahead of time by code generation and a native build; that build time is not timed. Process start-up and cold-cache effects are not measured. pg_jsonschema prepares on every call by design, so it has no separate figure.
Equivalent work: JSON text or parsed dataEvery engine receives a document already parsed into its own native form (serde_json::Value, BSON for MongoDB,sourcemeta::core::JSON for Blaze, a JS object for AJV). Parsing is built once and not timed.Parse cost is excluded for all engines. An end-to-end “JSON text to verdict” figure is not measured.
Equivalent work: which checks are enabledEvery keyword in each schema is evaluated; nothing is disabled. Regex engines keep their library defaults, including PCRE2’s match limit, and a limit that fires is reported as an outcome, never hidden.None known.
Equivalent work: pass/fail or a detailed reportPass/fail only, for every engine.Detailed-error-report (diagnostics) mode is not measured.
Representative inputs: sizes, valid and invalid, dependency complexity160 cases: 148 from jznschema’s own benchmark set plus 12 cross-engine probes. Most come as valid/invalid pairs. They cover objects, arrays, scalars, unions, $refrecursion, $dynamicRef, unevaluated*, conditionals and 24 regex cases. A growth curve tests input length up to 128 characters on a backtracking pattern.Documents are small (micro-benchmark sized). There is no sweep over large documents or large schemas, and schema/document sizes are not tabulated per case.
Engine settings, hardwareVersions, pins, toolchains, CPU, OS and pinning are listed in Machine and run discipline and Versions and pins.None known.
LatencyMedian, p95 and IQR per document, per case and engine (in results/results.csv).Single-threaded latency only; no latency under load.
Memory useNot measured.Memory is not measured.
Concurrency, throughput as traffic increasesSingle core, serial. Throughput is reported as validations per second on one core.Throughput under concurrent load is not measured.
Compatibility checks measured separatelyNot measured.Schema-vs-schema compatibility checking is not measured.
ReproduciblePinned revisions, one command per track, two full Track A runs agreeing per engine within ±1.1%, and timings within 0.98–0.99× of the engine author’s own harness.Results are from one machine.
No required checks turned offA correctness gate runs before any timing. A wrong verdict removes that row from every speed comparison and is reported.None known.

The four items marked not measured are listed again, with next steps, in the What was not measured section below.

Machine, run discipline and reproducibility

CPUAMD Ryzen 7 9700X (8 cores / 16 threads)
OSWSL2, Linux 6.6.87.2-microsoft-standard-WSL2
Pinningevery timed run is pinned to one core with taskset -c 6; runs are serial, on an otherwise quiet machine
ToolchainNode v22.18.0 (V8 12.4.254.21), Rust stable, Java HotSpot 23.0.2
Pinsjznschema 54a986d; hotdawg-regex a10b0d8 (Tracks A, B); hotdawg ff9f225 (Track C)

Baseline. All three tracks were run on this machine on 2026-11-21. Numbers from earlier versions of this work (June: 6.2× over MongoDB, 103 cases) are not comparable: the hardware, the corpus (now 160 cases) and every engine version changed.

How the comparison is kept fair

How the benchmark keeps the comparison fair: one corpus with exact verdicts; one driver process per engine that prepares once and validates many times on a pre-parsed document, pass/fail only; a correctness gate before any timing; 5 pinned trials; and a parity check against the engine author’s own harness.

Each driver is a separate process that speaks JSON lines to the orchestrator. It prepares the schema once, then runs a black-boxed validate-many loop over the pre-parsed document and times the loop itself, so process start-up and IPC are outside the measured region.

Statistics. Each (case, engine) pair gets 5 trials, with warmup dropped; the median, p95 and IQR are recorded. Loops are capped at 50,000 iterations; ns/op is a rate, so the cap does not bias it. “Fastest other” means the fastest non-Oracle engine on that case, among gate-passing rows.

Run-to-run reproducibility

Track A was run in full twice, before and after preparation time was added to the output (the timing code did not change). Per engine, the geomean of (second run ÷ first run) per case:

EngineCasesSecond ÷ first run (geomean)
Oracle jznschema (interpreted)1600.996
Oracle jznschema (compiled)1600.997
Blaze1580.989
MongoDB $jsonSchema711.010
jsonschema-rs1581.006
boon1580.990
AJV1520.991
pg_jsonschema1580.992

Every engine agrees within ±1.1%. Of the 1,175 individual rows, 1,096 (93%) are within ±10%; the largest single-row swings are on AJV (0.38–1.34×), which runs under a JIT.

Harness validation

Before any cross-engine number was published, our per-engine timings were checked against the engine author’s own benchmark harness (jznschema’s bench/sweep) on the same machine. That check found two biases in our harness. Both were fixed before the final run.

  1. serde_json/arbitrary_precision leaked across the Cargo workspace. The pg-jsonschema driver enabled the feature, and Cargo unifies features across a workspace, so every serde-based driver (Oracle, jsonschema-rs, boon) parsed and validated arbitrary-precision numbers. The pg-jsonschema replica no longer enables it, so no Rust driver uses it.
  2. The {v: …} root wrap was sent to every engine. MongoDB’s $jsonSchema only validates document roots, so scalar and array instances are wrapped as {v: …} for MongoDB. That wrapped form went to every engine. On the 70 unwrapped cases our timings already matched (1.00×); on the 78 wrapped cases jsonschema-rs and boon were 1.44× and 1.46× slower than upstream. The wrap is now MongoDB-only.

Harness parity at three stages. A ratio is our median ns ÷ the upstream harness’s ns per case, as a geomean. After both fixes all three engines are within 0.98–0.99× of upstream.

EngineUpstream harnessCasesFirst runAfter arbitrary-precision fixFinal run
Oracle jznschema (DecisionGraph)jznschema bench/sweep(dgraph.csv)1480.95×0.94×0.98×
jsonschema-rs 0.46.5jznschema bench/sweep(rustlibs.csv)1481.46×1.21×0.99×
boon 0.6.1jznschema bench/sweep(rustlibs.csv)1461.32×1.22×0.99×
hotdawg-lazy, schema strings (Track B)hotdawg bench/baseline.tsv111.02×
hotdawg, dictionary search (Track C)hotdawg bench/baseline.tsv190.95×

The first-run and final-run columns are recomputed from the saved result files; the middle column is from the run log. The run before preparation time was recorded gave 0.99× / 0.99× / 1.00×. hotdawg’s baseline.tsv was recorded on a different machine, so ±10% is the expected band for the last two rows.

Track A: JSON Schema validators

Engines

ValidatorVersionLanguageDocument formEngine
Oracle jznschema (interpreted)54a986dRustserde_json::ValueDecisionGraph (interpreted compiled graph); regex via hotdawg-regex a10b0d8
Oracle jznschema (compiled)54a986dRust → nativeserde_json::ValueDecisionGraph lowered to generated Rust and compiled ahead of time to machine code
MongoDB $jsonSchema7.0C++BSONthe real server InternalSchema*MatchExpression tree, linked in-process via stitch_support, nomongod; regex via PCRE2
Blaze (SourceMeta)7b214cf (= CLI 15.11.0)C++sourcemeta::core::JSONcompiled to an instruction template (FastValidation); regex via statically linked PCRE2
jsonschema-rs0.46.5Rustserde_json::ValueDraft 2020-12; regex via the Rust regex crate
pg_jsonschema(Postgres)jsonschema 0.46Rustserde_json::ValueSupabase’s extension engine as jsonb_matches_schemacalls it: compiles the schema on every call; engine only, no Postgres server
boon0.6.1Rustserde_json::ValueDraft 2020-12; regex via the Rust regex crate
AJV8.20.0JSJS objectDraft 2020-12, schema compiled to a function; regex via V8 irregexp

Corpus: 160 cases

  • 148 cases come verbatim from jznschema’s codegen_benchmark_cases(), dumped by drivers/rust/extract-cases tocorpus/jznschema_cases.json.
  • 12 are local cross-engine probes: $dynamicRef nested-id and override probes, acyclic-ref microbenchmarks, and the regex_backtrack_limit_* pair.
FamilyCases
unevaluated*44
scalar/coverage24
array24
regex24
union-dispatch15
dynamicRef8
anyOf7
object5
conditional5
ref4

MongoDB’s $jsonSchema implements a Draft-4 subset plus bsonType, so the corpus is split into two tiers. The split is derived, not asserted: a case is Tier-1 if and only if a strict allowlist translator can produce a faithful MongoDB schema (type/integer → bsonType, const → enum, numeric exclusiveMin/Max → the Draft-4 boolean form, dependentRequired/dependentSchemas →dependencies, pattern passed through).

  • Tier-1, comparable on MongoDB: 72 cases, including 22 of the 24 regex cases.
  • Tier-2: 88 cases using unevaluated*, $ref/recursion, $dynamicRef, if/then/else, prefixItems, contains or propertyNames. MongoDB is N/A on all of them by design.

Correctness gate

Before any timing counts, every engine’s verdict is compared with each case’s expected verdict. The gate collects disagreements rather than aborting.

  • Oracle interpreted and Oracle compiled match the expected verdict on all 160 cases. MongoDB matches on 71 of its 72 Tier-1 cases.
  • There are 9 verdict mismatches (results/gate_mismatches.json):
EngineCaseWhat happened
Blazedynamic_ref_successExpected valid; Blaze says invalid. Oracle (both backends) and boon say valid.
AJVoson_unevaluated_items_contains_failureWrong verdict on cooperative unevaluatedItems.
AJVoson_unevaluated_items_anyof_cooperative_successSame as above.
jsonschema-rsdynamic_ref_nested_id_scope_successA $dynamicRef inside a nested $idresource must still see the outer dynamic scope.
jsonschema-rsdynamic_ref_nested_id_scope_failureSame as above.
pg_jsonschemadynamic_ref_nested_id_scope_successSame engine as jsonschema-rs, same failure.
pg_jsonschemadynamic_ref_nested_id_scope_failureSame as above.
MongoDBregex_backtrack_limit_successExpected valid; MongoDB says invalid when its regex match limit fires (see below).
Blazeregex_backtrack_limit_successSame as MongoDB.
  • There are 8 errors: AJV rejects relative $dynamicRef URI forms (4) and overflows the stack on the acyclic $dynamicRefcases (2); boon rejects regex_lookahead_password_* at compile time because its regex dialect has no lookahead (2).

On the $dynamicRef probes, boon is the only non-Oracle engine that clears every case.

The cost of checking every order

The article frames performance as “what does validating every incoming order add?”. To answer it with corpus data, we picked six Tier-1 cases whose schemas look like parts of an order contract, and show the two costs separately: checking one document with a prepared validator, and preparing the schema in the first place.

The cost of checking every order. Top: time per document on six order-shaped schemas. Bottom: preparation time for the same six schemas, once per schema, in a fresh process.

The six cases (all valid documents):

Label in the figureCase idSchema
required, typed fieldsobject_required_typed_success{"type":"object","required":["a","b"],"properties":{"a":{"type":"integer"},"b":{"type":"integer"}}}
card number ⇒ billing fieldsoson_dependent_required_success{"type":"object","dependentRequired":{"credit_card":["billing_address","billing_zip"]}}
number in rangescalar_number_bounds_success{"type":"number","minimum":1,"maximum":10}
string lengthscalar_string_length_success{"type":"string","minLength":3,"maxLength":8}
UUID patternregex_uuid_success{"type":"string","pattern":"^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"}
wide object + additionalPropertieswide_additional_properties_success20+ declared integer properties,additionalProperties: {"type":"string"}

Median time per document:

CaseOracle compiledOracle interpretedBlazejsonschema-rsboonMongoDBAJV
object_required_typed_success2.2 ns13 ns7.5 ns18 ns89 ns97 ns98 ns
oson_dependent_required_success2.6 ns15 ns14 ns17 ns39 ns82 ns83 ns
scalar_number_bounds_success0.6 ns2.4 ns9.4 ns5.8 ns19 ns105 ns73 ns
scalar_string_length_success4.0 ns2.4 ns6.1 ns8.4 ns20 ns105 ns87 ns
regex_uuid_success34 ns36 ns22 ns48 ns63 ns165 ns101 ns
wide_additional_properties_success29 ns77 ns513 ns228 ns1.3 µs3.5 µs304 ns

What it shows:

  • On these schemas every engine checks a document in nanoseconds to a few microseconds.
  • Among the engines that prepare at runtime, Oracle interpreted is fastest on three of the six (number range, string length, wide object). Blaze is faster on the other three: required typed fields (7.5 ns vs 13 ns), card ⇒ billing fields (14 ns vs 15 ns) and the UUID pattern (22 ns vs 36 ns).
  • MongoDB is the slowest per document on four of the six and within 1% of AJV on the other two, but it is the fastest to prepare (median 52 µs over these six schemas, against 96 µs for Oracle and 111 µs for Blaze).
  • The compiled backend has no runtime preparation step: its validator is generated as Rust and compiled ahead of time. That build is a separate, offline cost and is not timed here.

Preparation, reported separately

Median preparation time per schema, measured once per case in a fresh driver process:

EngineAll cases it runs (n)MedianMin – maxTier-1 common cases (n)Median
MongoDB $jsonSchema7256 µs38 µs – 711 µs7156 µs
Oracle jznschema (interpreted)160150 µs63 µs – 12.5 ms71116 µs
Blaze160182 µs60 µs – 16.3 ms71163 µs
jsonschema-rs160868 µs766 µs – 1.53 ms71866 µs
boon1581.51 ms1.34 ms – 4.36 ms691.52 ms
AJV15425.9 ms23.8 ms – 124 ms7125.3 ms
Oracle jznschema (compiled)—ahead of timenot timed——
pg_jsonschema—on every callincluded in each check——

MongoDB prepares a schema fastest, on the whole corpus and on the cases both engines share. Oracle and Blaze have the same worst case, wide_late_any_of (a wide anyOf of deep objects): 12.5 ms for Oracle and 16.3 ms for Blaze, against 0.71 ms for MongoDB. jsonschema-rs and boon spend most of their preparation on fixed set-up (their minimum is above 0.7 ms), and AJV generates and compiles JavaScript.

Where the break-even falls: per Tier-1 case, Oracle’s extra preparation time over MongoDB divided by its per-document saving is a median of about 330 documents (60 of 71 cases break even within 1,000 documents, all 71 within 9,000). A long-running service that prepares each contract once pays it once. A short-lived process that prepares a schema for a handful of documents does better with MongoDB’s faster preparation.

Scorecard

Scorecard: jznschema compiled and interpreted against each named engine, geomean over the cases both engines pass, with win counts.

vsnOracle compiledOracle interpreted
Fastest other engine, per case1604.33×, wins 1411.11×, wins 92
Blaze1587.72×, wins 1511.96×, wins 107
jsonschema-rs1586.27×, wins 1471.65×, wins 117
AJV15228.6×, wins 1497.54×, wins 134
boon15836.6×, wins 1589.22×, wins 155
MongoDB $jsonSchema (Tier-1)7153.3×, wins 7118.4×, wins 71
pg_jsonschema (recompiles per call)1581,128×, wins 158297×, wins 158

Against the fastest other engine, split by tier:

Oracle compiledOracle interpreted
Tier-1 (72)3.30×, wins 601.16×, wins 41
Tier-2 (88)5.42×, wins 811.06×, wins 51

Compiled vs interpreted Oracle, all 160 cases: 3.91×.

Oracle vs MongoDB

Oracle jznschema vs MongoDB per category: geomean speedup with case counts. Two regex cases are bound by MongoDB’s match limit.

HeadlineValue
Oracle interpreted vs MongoDB, Tier-118.4× geomean over 71 cases, faster on all 71 (1.50×–73,299×; median 12.8×)
… without the 2 limit-bound cases14.6× geomean over 69 cases
Oracle compiled vs MongoDB, Tier-153.3× geomean

The comparison covers 71 of the 72 Tier-1 cases. regex_backtrack_limit_success is left out because MongoDB’s verdict on it is wrong, and gate-failing rows are never timed against. Two of the 71 are timed by MongoDB’s match limit rather than by matching: regex_nested_quantifier_failure (73,299×) and regex_backtrack_limit_failure (58,586×). In both, the verdict is right but PCRE2 reaches it by hitting its limit. Without them the regex category falls from 17.5× to 7.4×.

Oracle jznschema (interpreted) speedup over MongoDB, every Tier-1 case.

Throughput by category

Tier-1 throughput by category, all eight engines.
Tier-2: cases MongoDB $jsonSchema cannot express.

On the Tier-2 cases MongoDB is N/A by design, and the point there is coverage. The compiled backend leads in almost every category. The interpreted backend is competitive but not always fastest; on scalar/coverage and regex, several engines are within a small factor of each other.

Regex slice: where Oracle is not ahead

Track A regex slice: Oracle vs the fastest other validator on each of the 24 regex cases.

On the 24 regex_* cases, the interpreted backend comes in at 0.98× of the fastest other validator and wins 12/24; the compiled backend comes in at 1.07× and wins 13/24. On the original 22 cases (without the backtrack_limit pair), the figures are 0.95× and 1.07×. The fastest other is usually Blaze (PCRE2) or jsonschema-rs (the Rust regex crate).

  • Losses (interpreted). pattern_properties_wide ✗ (0.55× vs AJV), uuid (0.56–0.61×), items_pattern (0.57–0.58×),lazy_dfa ✓ (0.70×), nested_quantifier ✓ (0.77×), and search_long, email ✓, lazy_dfa ✗ at 0.80–0.90×. The compiled backend turns items_pattern into a win (1.16–1.25×) but still loses uuid (0.61–0.64×).
  • Wins. lookahead_password (1.16–1.58× interpreted, 1.25–1.84× compiled), any_of_patterns (1.40–1.43×; compiled 2.00–2.02×), unicode_property ✗ (1.48×), pattern_properties_wide ✓ (1.42×), property_names_wide (1.30–1.32×), andbacktrack_limit (1.29–1.30×).

Backtracking growth curve

{"type":"string","pattern":"^(a+)+$"}, the shape of regex_nested_quantifier_failure, is validated against "a"×n + "!"(always invalid) at n ∈ {8, 12, 16, 20, 24, 28, 32, 40, 64, 128}, on every Track A engine except pg_jsonschema. Each (engine, n) gets a calibration trial and then 5 timed trials (3 above 1 s per document). An engine is stopped when a document takes more than 5 s or when growth from the previous n predicts it would. Every engine returned invalid at every measured n.

enginen=81216202428324064128
Oracle interpreted11 ns13 ns18 ns21 ns24 ns28 ns31 ns38 ns70 ns165 ns
Oracle compiled9 ns11 ns16 ns19 ns22 ns25 ns28 ns35 ns65 ns162 ns
jsonschema-rs18 ns21 ns24 ns27 ns32 ns38 ns42 ns50 ns76 ns153 ns
boon73 ns81 ns83 ns87 ns90 ns94 ns99 ns109 ns135 ns205 ns
AJV (V8)706 ns11.1 µs175 µs2.80 ms44.7 ms716 mscappedcappedcappedcapped
MongoDB (PCRE2)4.7 µs74.3 µs1.20 ms1.45 ms1.45 ms1.44 ms1.46 ms1.46 ms1.44 ms1.45 ms
Blaze (PCRE2)441 ns6.9 µs110 µs1.75 ms8.35 ms8.34 ms8.39 ms8.28 ms8.35 ms8.34 ms
Backtracking growth curve: time per document against input length.
  • The automaton engines are linear: Oracle (both backends, via hotdawg-regex), jsonschema-rs and boon (both on the Rustregex crate), at 9–205 ns per document even at n=128.
  • AJV grows by 16× every 4 characters and would take about 11 s per document at n=32.
  • MongoDB and Blaze flatten out, and the flat part is not a fast path. It is PCRE2’s match limit firing: MongoDB levels off at 1.45 ms from n=20, Blaze at 8.3 ms from n=24. Both link PCRE2, and Track B shows PCRE2 hitting its default match limit on this exact pattern from n=24. On this schema “does not match” happens to be the right verdict, so the gate passes.

Regex match limits: a check that could not run reported as “invalid”

When PCRE2’s match limit fires, MongoDB and Blaze report the document invalid, including when it is valid. This is a measured corpus result. The probe pair regex_backtrack_limit_* uses {"type":"string","pattern":"^(?:(a+)+b|a+)$"}:

  • "a"×24 is valid: the first alternative backtracks exponentially and fails, then a+ matches.
  • "a"×24 + "!" is invalid.
Verdicts on the valid document “a”×24: the automaton engines say valid in nanoseconds, AJV says valid in 31 ms, MongoDB and Blaze say invalid because their match limit fired.
caseexpectedOracleOracle compiledjsonschema-rsboonAJVMongoDBBlaze
regex_backtrack_limit_successvalidvalid, 26 nsvalid, 32 nsvalid, 33 nsvalid, 51 nsvalid, 31.4 msinvalid, 1.42 msinvalid, 8.0 ms
regex_backtrack_limit_failureinvalidinvalid, 25 nsinvalid, 33 nsinvalid, 33 nsinvalid, 90 nsinvalid, 31.8 msinvalid, 1.46 msinvalid, 8.8 ms

pg_jsonschema (the same engine as jsonschema-rs, recompiling per call) answers both correctly in 15–17 µs.

  • The automaton engines answer in tens of nanoseconds; there is no match limit to hit.
  • AJV (V8, a backtracker with no limit) is right on both but takes about 31 ms per document.
  • MongoDB and Blaze stop at the same limit-bound times as on the growth curve and give the wrong answer on the valid document. Both rows are in gate_mismatches.json and excluded from every speed comparison. We observe the verdict; that the engines map the limit error to “no match” is inferred from behaviour, not from reading their source.

The same behaviour at other lengths, from an untimed probe (node scripts/redos-failclosed.mjs '^(?:(a+)+b|a+)$') on"a"×n:

nOraclejsonschema-rsboonBlazeMongoDBAJV
10validvalidvalidvalidvalidvalid
20validvalidvalidvalid (2.1 ms)invalid (1.45 ms)valid (2.0 ms)
30validvalidvalidinvalid (8.1 ms)invalid (1.4 ms)valid (2.0 s)

On this shape a backtracking engine either blows up (AJV) or, with a limit, returns an answer that was never computed (MongoDB, Blaze). The article’s rule applies: a check that could not run is a different outcome from a validation failure, and should be reported as one.

pg_jsonschema (Postgres)

pg_jsonschema is Supabase’s Postgres extension. Its jsonb_matches_schema(schema, instance) calls jsonschema::is_valid, which recompiles the schema on every call. We benchmark that engine path in-process, without a Postgres server.

  • It is 180× slower (geomean) than the same engine used compile-once (jsonschema-rs), over 158 shared cases.
  • Its median is about 0.16M validations per second, the slowest in the comparison.
  • A real in-database measurement would add SPI, JSONB detoast and FFI costs on top.
  • It has the same nested-id $dynamicRef gate failures as jsonschema-rs.

Disclosed caveats

  1. Representation. MongoDB validates BSON; the Rust and JS engines validate parsed JSON. Each document is built once in each engine’s native form, untimed. For scalar and array roots, MongoDB alone gets the {v: …} wrap.
  2. Number typing. bsonType checks type tags strictly. The BSON encoder pins integer and double typing in lockstep with the translator, and the gate checks agreement on every document.
  3. MongoDB is 7.0, built from source (stitch_support). Newer MongoDB releases were not measured.
  4. Small documents. The corpus documents are small, so these are per-check costs, not a model of a full order pipeline.

Track B: regex engines

Question. jznschema validates pattern with hotdawg-regex, a DFA built from Brzozowski derivatives. How does it compare with the regex engines other validators and databases use?

EngineVersionKindUsed by
hotdawg-lazy (reference)hotdawg-regex a10b0d8lazy DFA (LazyDfa), ECMA syntaxjznschema
hotdawg-densehotdawg-regex a10b0d8DFA built ahead of time (DenseMatcher, 100k-state budget)—
Rust regex1.13.2 (regex-automata 0.4.19)hybrid NFA / lazy DFA, no backtrackingjsonschema-rs, boon
fancy-regex0.20.2backtracking for lookaround and backrefs; default backtrack limit—
PCRE2 (JIT)10.42backtracking, JIT, default match limitMongoDB, Blaze
PCRE2 (interpreter)10.42backtracking, default match limit—
RE22024-07-02 (abseil 20240722.0)automaton, no lookaround—
V8 irregexp12.4.254.21 (Node v22.18.0)backtracking, JITAJV

Patterns are written in ECMA-262 and translated per engine. If a translation cannot express a construct (for example lookaround onregex or RE2), the result is recorded as unsupported, never as zero matches.

Workloads: 117 cases, generated deterministically by a byte-for-byte port of hotdawg’s data generators at a10b0d8:

WorkloadCasesWhat
schema strings41the jznschema regex_* patterns plus hotdawg’s schema set (date, phone, uuid, email, semver, identifier, \p{L}, lookaround, …) over 200,000 structured strings, about half valid; ns per string
text search5117 patterns × {scan 20 MB of pseudo-English, per line (293,719 lines), per word (10,185 words)}
backtracking blow-ups244 groups (nested +, alternation, words, *-of-*) × n ∈ {16, 20, 24, 28, 32, 1000}; 5 s/test cap with growth prediction
state explosion1a[ab]{20}c over a 20 KB a/b input; a full DFA needs about 2²⁰ states

Gate. Every engine’s match count must equal hotdawg-lazy’s. Result: 0 mismatches. Other outcomes are their own categories, never misses: limit (the engine’s own backtrack/match limit fired; PCRE2 and fancy-regex keep library defaults), capped (the 5-second rule), unsupported.

Results

Track B: regex engines relative to hotdawg-lazy. Everyday workloads on a narrow axis; pathological inputs on a wide log axis.

Engine time ÷ hotdawg-lazy time, geomean over gate-passing cases (above 1× = hotdawg-lazy faster; (k/N) = engine finished k of N):

Engineschema stringstext searchbacktrackingstate explosion (absolute)
hotdawg-dense0.92×0.94×0.72×unsupported (state budget)
Rust regex1.03× (37/41)1.02×0.81×22 µs
fancy-regex1.63×1.68× (50/51)1.08×22 µs
PCRE2 JIT1.63×3.02×191× (15/24)284 ns
PCRE2 interpreter2.29×7.38×468× (14/24)94 ns
RE21.56× (37/41)2.89×1.54×6.68 ms
V81.67×5.23×131,578× (17/24)375 µs
hotdawg-lazy (absolute)2–34 ns per string7.54 ms
Track B outcome per engine and workload.
  • hotdawg-lazy is level with the Rust regex crate on schema strings and text (1.02–1.03×) and ahead of every backtracking engine and RE2 (1.56–7.38×). On backtracking patterns the automaton engines stay linear; PCRE2 hits its match limit on 8–10 of the 24 cases and V8 is capped on 7.
  • hotdawg-lazy is not the fastest automaton. hotdawg’s own DenseMatcher beats it on every workload it can build (0.72–0.94×), and the regex crate beats it on the backtracking set (0.81×).
  • State explosion is a clear loss. On a[ab]{20}c hotdawg-lazy takes 7.5 ms; PCRE2 takes 94 ns (interpreter) and 284 ns (JIT), the regex crate 22 µs, V8 375 µs. A backtracker finds the early match at once, while a lazy DFA keeps building new states. DenseMatcher refuses the pattern (more than 100k states).
  • The backtracking geomeans for PCRE2 and V8 cover only the lengths they finished.
  • Unicode: hotdawg reports Unicode 16.0.0 and V8 16.0; \p{…} cases agree on every count.

Track C: dictionary search

Question. hotdawg also provides a DAWG term dictionary with regex, fuzzy, phonetic and accent-folded search. How does it compare with the FST libraries search engines use?

EngineVersionStructure
hotdawg (reference)git ff9f225DAWG; Dawg, MutableDawg, Trie, snapshot + delta merge
fst0.4.7 (regex-automata 0.1.10)FST Set, with regex and Levenshtein automata
tantivy-fst0.5.0 (levenshtein_automata 0.2.1)tantivy’s fork, Map from term to ordinal
Lucene 10 FSTlucene-core 10.6.0, Java 23.0.2FSTCompiler (BYTE1, NoOutputs), walked by DFS × ByteRunAutomaton
Lucene 10 termslucene-core 10.6.0an index term dictionary (BlockTree),Terms.intersect
naive (correctness oracle)regex 1.13.2, rphonetic 4.0.1sorted Vec<String> and a full scan

JVM: -Xms4g -Xmx4g -XX:+UseParallelGC; Lucene drivers warm up until the coefficient of variation over the last 5 runs is under 5%.

DatasetTermsSource
synthetic300,000hotdawg bench_suite dictionary()
english370,105dwyl words_alpha.txt (Unlicense), downloaded, never committed
synthetic-mixed, english-mixedsameevery 3rd term accented, every 5th capitalised (folded search)

Operations: build, size, open, encode/decode, exact lookup, prefix enumeration, regex search, fuzzy search at d=1 and d=2 (with and without transpositions), folded search, Soundex and Metaphone, trie insert, 10k-term update and folded batches, and snapshot+delta merged search: 468 rows. Query times include building the automaton.

Gate. Each engine’s sorted result set is SHA-256 hashed and compared with the naive scan’s. Result on hotdawg ff9f225: 0 mismatches (316 ok rows, 152 unsupported).

Results

Track C: dictionary search relative to hotdawg. Query operations, lifecycle (build and update), and open on its own axis.

Engine time ÷ hotdawg time, geomean over gate-passing rows on both dictionaries (above 1× = hotdawg faster):

Operationfsttantivy-fstLucene FSTLucene termsnaive
exact lookup1.23×1.28×2.07×3.59×1.65×
prefix1.59×2.03×3.76×3.13×0.03×
regex2.19×3.17×2.44×0.78×1.92×
fuzzy1.67× (no transpositions only)1.07×1.77×1.60×149×
10k update batch0.88× (rebuild)0.94× (rebuild)1.32× (rebuild)n/a0.07×
10k folded batch1.11×1.17×1.65×n/a0.08×
build0.31×0.31×0.56×n/a0.03×
open0.00004× (42–58 ns vs 0.94–1.7 ms)0.00004×0.08×n/a8.74×

Phonetic and folded operations have no counterpart in the other engines, so hotdawg is compared only with the naive scan there: Soundex 1,170×, Metaphone 18.8× and fold 29× faster.

Track C capability matrix.
Track C structure size per engine and dataset.
  • Where hotdawg wins. Lookup, prefix, regex and fuzzy against fst, tantivy-fst and Lucene FST: 1.07–3.76×. It is the only engine here with query-time phonetic search, query-time folded search and incremental update.
  • Lucene’s BlockTree terms dictionary beats hotdawg on regex search (0.78×).
  • Rebuilding is faster than hotdawg’s incremental update at this batch size: a full fst rebuild costs 0.88× of hotdawg’s 10k-term update, tantivy-fst 0.94×; a sorted Vec merge 0.07×. The mutable path buys flexibility, not speed.
  • hotdawg’s structure is larger and slower to build. 16.9 MB against 3.1 MB for fst on synthetic, and 4.9 MB against 1.4–1.7 MB on English: 3.0–5.5× the fst and Lucene FST size, and larger than the raw term bytes. Build is 3.3× slower than fst (520 ms vs 114 ms on synthetic) and 1.8× slower than Lucene. fst and tantivy-fst open in 41–58 ns (a zero-copy view); hotdawg takes 0.94–1.7 ms.
  • Not supported elsewhere. Lucene’s & (intersection) and ~ (complement) regex syntax is benchmarked as hotdawg-only. fst’s Levenshtein has no transposition mode, so fst runs only 8 of the 16 fuzzy cases.

Metaphone: found by the gate, fixed upstream in ff9f225

  • What the gate found. On hotdawg a10b0d8, the gate flagged dawg/metaphone/shaker. hotdawg encoded a word-initial CH+ vowel as X, where Apache commons-codec (and rphonetic 4.0.1, used by the naive engine) gives K. So chacker came out as XKR instead of KKR, and a search for shaker (XKR) returned it: 22 results against 15 on synthetic, 46 against 14 on English.
  • Fix. Reported as hotdawg issue #1 and fixed in ff9f225 (“Metaphone: word-initial CH before a vowel encodes as K”), which also corrected the shaker check value in hotdawg’s own bench/baseline.tsv from 22 to 15.
  • Re-run. On ff9f225 hotdawg returns 15 and 14, matching the naive oracle. The gate is clean. Tracks A and B stay on hotdawg-regex a10b0d8: between the two revisions the regex/ crate is byte-identical.

What was not measured

The article asks for these, and this benchmark does not yet provide them:

Not measuredWhy it mattersNext step
Memory useThe article asks what validation adds to memory, not only to time.Record peak RSS per driver after preparation and during the validate loop, and the size of each prepared validator.
Throughput under concurrent loadResults should show what happens as traffic increases. Everything here is one thread on one pinned core.A multi-threaded validate loop (1, 2, 4, 8 threads) sharing one prepared validator, reporting throughput and p95/p99 latency.
Compatibility checks (schema vs schema)The article says comparing two schema versions is a separate job and needs separate measurements: which comparisons resolve, how long they take, how useful the explanations are.A corpus of schema pairs with expected verdicts, including cases that cannot be decided, timed separately from document validation.
Detailed-error-report (diagnostics) modeEvery engine here returns pass/fail only. A full error report costs more, and engines differ in what they report.Re-run the invalid half of the corpus with each engine’s error-collecting API, timed and compared for content.
End-to-end “JSON text to verdict”Parsing is excluded for every engine.Time parse + validate from the same bytes.
Large documents and schemasThe corpus documents are small.A size sweep over document and schema size.
Ahead-of-time build cost of the compiled backendIt is a real cost, paid offline.Time code generation and the native build per schema.

Versions, pins, licensing and how to reproduce

Versions and pins

ComponentVersion / pin
Oracle jznschema (both backends)54a986d
hotdawg-regex (Tracks A, B)a10b0d8
hotdawg (Track C)ff9f225
MongoDB stitch_support7.0
Blaze7b214cf (= CLI 15.11.0)
jsonschema-rs0.46.5
boon0.6.1
AJV8.20.0
Rust regex1.13.2 (regex-automata 0.4.19)
fancy-regex0.20.2
PCRE210.42
RE22024-07-02 (abseil 20240722.0)
V812.4.254.21 (Node v22.18.0)
fst / tantivy-fst0.4.7 / 0.5.0
Lucenelucene-core 10.6.0 (Java HotSpot 23.0.2)

Licensing

schemaBench is Apache-2.0. Every engine is consumed, never vendored: each is built from a pinned source on the user’s machine and talks to the orchestrator over stdin/stdout.

ComponentLicenseHow it is consumed
jznschemano license file (Oracle research artifact)git dependency at a pinned rev
hotdawg / hotdawg-regexno LICENSE file (publish = false)git dependency at pinned revs; never redistributed
MongoDB stitch_support 7.0SSPL v1separate executable (../mongoJsonValidator)
BlazeAGPL-3.0separate executable (../blazeJsonValidator)
PCRE2BSD-3-Clause (pcre2-sys: Unlicense OR MIT)system/bundled library
RE2 + abseilBSD-3-Clause / Apache-2.0built from source
fst, tantivy-fstUnlicense / MITcrates.io
levenshtein_automata, fancy-regexMITcrates.io
Rust regexMIT OR Apache-2.0crates.io
rphoneticApache-2.0crates.io
Lucene 10Apache-2.0Maven
V8 (via Node)BSD-3-Clausethe Node runtime
jsonschema-rs, boon, AJVMIT / MIT OR Apache-2.0 / MITcrates.io, npm
dwyl words_alpha.txtUnlicensedownloaded at build time, never committed

How to reproduce

npm install && npm run build
source scripts/env.sh # before any cargo command
(cd drivers/rust && cargo build --release)
./drivers/rust/target/release/extract-cases > corpus/jznschema_cases.json
node dist/corpus/generate.js # corpus/corpus.json (160 cases)
./drivers/rust/target/release/oracle-compiled-gen && (cd drivers/rust/compiled-bench && cargo build --release)
# MongoDB (../mongoJsonValidator) and Blaze (../blazeJsonValidator) drivers: see their build/ scripts.

taskset -c 6 node dist/src/cli.js run # Track A -> results/results.{json,csv}, gate_mismatches.json
taskset -c 6 node dist/src/cli.js run --track a-redos # growth curve -> results/redos.{json,csv}
drivers/cpp/re2-driver/build-re2.sh # RE2 driver (Track B)
taskset -c 6 node dist/src/cli.js run --track b # Track B -> results/regex/
scripts/dict/fetch-data.sh # Track C datasets
(cd drivers/java/lucene-dict-driver && mvn -q -B package)
taskset -c 6 node dist/src/cli.js run --track c # Track C -> results/dict/
python3 charts/render.py # report charts
python3 charts/article_figs.py # article figures (set JZN_SWEEP_RESULTS to recompute parity)
pandoc report/FULL_REPORT.md --embed-resources --standalone --toc --toc-depth=2 \
--css report/report.css --resource-path=report:. -o "schemaBench - Fast Validator Benchmark Report.html"

Full per-row data is in the results.{json,csv} file under each results/ directory, with metadata (versions, host, dataset hashes) in each JSON. Disagreements are in each gate_mismatches.json.


schemaBench benchmark report, 2026-11-21. jznschema and hotdawg are by Patrick Meredith.