benchmarks #

This page compares fuz_schemamaintainer's with Valibot, Zod, Zod compiled, Zod Mini, TypeBox, Valita, and Sury: the bytes each ships, how long a parse takes, what a fresh process pays before its first parse, what stays in memory, and what the types cost the compiler. fuz_schema compiledmaintainer's is fuz_schema in another mode and not another library, a column of its own beside it: what its figures include is under each table. The maintainer of these benchmarks also maintains fuz_schema, so that library is marked wherever it is named, in each mode, and how every number was measured is published with the numbers.

Every figure here is rendered from one results file, of one run. Beside a number is its ratio to the least in its row, or the most where higher is better, which reads 1.00×: 2.00× is twice as slow or twice as large. Hover a number to compare its row against that library instead. A ratio marked ≈ is inside what the two numbers range over, and one marked ~ has a time at the call floor: neither is a difference, and each is colored as level whatever it reads. Where a number is level with the row's least, the least is marked ≈ too: the readings don't tell the two apart, and neither is the better. For two numbers of a row, what they range over is the two spreads together, the ± beside each. A geometric mean has a band in place of a spread, printed under it, from the mean of its rows' least readings to the mean of their most, and two means whose bands overlap are level. Each table says how its own figures are compared. A cell with no number says why it has none, and a number marked † is not ranked, nor is its row until a library is hovered. Bytes are in decimal units throughout: 1 kB is 1,000 bytes.

Cell tint, by ratio to the row's baseline:
  • under 0.9×, better than the baseline
  • 0.9–1.1×, level
  • 1.1–2×
  • 2–5×
  • 5–10×
  • 10–100×
  • 100× or more

Bundle size
#

What each library adds to a page that validates one thing: an entry that imports one scenario's schema and calls it, bundled and minified by Rolldown 1.2.19, then compressed. These are bytes, so they are exact: the same sources, bundler, and zlib give the same figures on any machine.

Minified and gzipped, in bytes. Bytes of a bundle are exact, so any gap is a difference.
scenariofuz_schemamaintainer'sfuz_schema compiledmaintainer'sValibotZodZod compiledZod MiniTypeBoxValitaSury
every scenario in one bundle 3.03 kB 1.00× 8.56 kB 2.82× 3.56 kB 1.18× 26.0 kB 8.58× 33.1 kB 10.9× 9.21 kB 3.04× 39.5 kB 13.0× 5.45 kB 1.80× 23.3 kB 7.70×
string 354 B 1.00× 6.02 kB 17.0× 760 B 2.15× 19.0 kB 53.8× 26.4 kB 74.6× 3.06 kB 8.64× 38.4 kB 108× 1.95 kB 5.50× 6.50 kB 18.3×
object_flat 841 B 1.00× 6.46 kB 7.68× 1.30 kB 1.55× 24.1 kB 28.7× 31.2 kB 37.1× 4.86 kB 5.78× 38.4 kB 45.7× 3.07 kB 3.65× 18.4 kB 21.9×
object_copy 1.18 kB 1.00× 6.75 kB 5.70× 1.54 kB 1.30× 24.0 kB 20.3× 31.1 kB 26.2× 5.21 kB 4.40× 38.4 kB 32.5× 3.99 kB 3.37× 19.7 kB 16.6×
strict_nested 921 B 1.00× 6.53 kB 7.09× 1.37 kB 1.49× 24.0 kB 26.1× 31.1 kB 33.7× 5.00 kB 5.43× 38.5 kB 41.8× 3.51 kB 3.81× 11.3 kB 12.3×
pipe 1.12 kB 1.00× 6.73 kB 5.99× 1.58 kB 1.41× 24.0 kB 21.4× 31.1 kB 27.7× 5.66 kB 5.04× 38.5 kB 34.2× 3.09 kB 2.75× 12.8 kB 11.4×
union 951 B 1.00× 6.50 kB 6.83× 1.27 kB 1.34× 20.4 kB 21.4× 27.7 kB 29.1× 4.39 kB 4.62× 38.4 kB 40.4× 3.44 kB 3.62× 17.7 kB 18.6×
list 972 B 1.00× 6.57 kB 6.76× 1.47 kB 1.51× 24.1 kB 24.8× 31.2 kB 32.1× 5.34 kB 5.49× 38.5 kB 39.6× 3.52 kB 3.62× 18.6 kB 19.1×
type_json 1.71 kB 1.00× 7.23 kB 4.23× 2.40 kB 1.41× 25.3 kB 14.8× 32.3 kB 18.9× 6.68 kB 3.91× 38.7 kB 22.6× 4.69 kB 2.74× 19.9 kB 11.7×
app 2.18 kB 1.00× 7.74 kB 3.54× 2.88 kB 1.32× 25.4 kB 11.7× 32.6 kB 14.9× 8.34 kB 3.82× 39.1 kB 17.9× 4.99 kB 2.28× 20.9 kB 9.58×
  • fuz_schema compiled: It carries the compiler of compile.ts, and compiles while the schema is built.
  • Zod compiled: It carries the compiler z.compile needs, and compiles while the schema is built.
  • Sury: It carries its compiler, and compiles while the schema is built.
The same in brotli's bytes, and uncompressed
Minified and brotli-compressed, in bytes.
scenariofuz_schemamaintainer'sfuz_schema compiledmaintainer'sValibotZodZod compiledZod MiniTypeBoxValitaSury
every scenario in one bundle 2.75 kB 1.00× 7.78 kB 2.83× 3.23 kB 1.17× 23.0 kB 8.35× 29.2 kB 10.6× 8.36 kB 3.04× 33.8 kB 12.3× 4.97 kB 1.81× 21.1 kB 7.67×
string 304 B 1.00× 5.51 kB 18.1× 677 B 2.23× 16.9 kB 55.6× 23.5 kB 77.2× 2.80 kB 9.20× 32.9 kB 108× 1.74 kB 5.73× 5.97 kB 19.6×
object_flat 763 B 1.00× 5.90 kB 7.74× 1.18 kB 1.54× 21.3 kB 28.0× 27.5 kB 36.0× 4.44 kB 5.82× 32.9 kB 43.1× 2.78 kB 3.64× 16.7 kB 21.9×
object_copy 1.07 kB 1.00× 6.17 kB 5.76× 1.40 kB 1.30× 21.3 kB 19.9× 27.4 kB 25.6× 4.76 kB 4.45× 32.9 kB 30.7× 3.64 kB 3.40× 17.8 kB 16.7×
strict_nested 841 B 1.00× 5.97 kB 7.10× 1.23 kB 1.46× 21.2 kB 25.3× 27.4 kB 32.6× 4.57 kB 5.43× 32.9 kB 39.1× 3.19 kB 3.79× 10.3 kB 12.3×
pipe 1.03 kB 1.00× 6.14 kB 5.95× 1.44 kB 1.40× 21.3 kB 20.6× 27.4 kB 26.5× 5.16 kB 5.00× 32.9 kB 31.9× 2.81 kB 2.72× 11.7 kB 11.3×
union 874 B 1.00× 5.96 kB 6.82× 1.15 kB 1.31× 18.1 kB 20.7× 24.5 kB 28.1× 3.98 kB 4.55× 32.9 kB 37.7× 3.15 kB 3.61× 16.1 kB 18.4×
list 885 B 1.00× 6.01 kB 6.79× 1.32 kB 1.49× 21.4 kB 24.2× 27.5 kB 31.1× 4.87 kB 5.51× 32.9 kB 37.2× 3.20 kB 3.61× 16.8 kB 19.0×
type_json 1.56 kB 1.00× 6.62 kB 4.23× 2.19 kB 1.40× 22.3 kB 14.2× 28.4 kB 18.2× 6.11 kB 3.91× 33.2 kB 21.2× 4.30 kB 2.75× 18.1 kB 11.6×
app 1.97 kB 1.00× 7.05 kB 3.58× 2.60 kB 1.32× 22.5 kB 11.4× 28.6 kB 14.6× 7.56 kB 3.84× 33.5 kB 17.0× 4.53 kB 2.30× 18.9 kB 9.61×
Minified, in bytes.
scenariofuz_schemamaintainer'sfuz_schema compiledmaintainer'sValibotZodZod compiledZod MiniTypeBoxValitaSury
every scenario in one bundle 10.0 kB 1.00× 27.4 kB 2.73× 16.2 kB 1.62× 95.7 kB 9.54× 126 kB 12.5× 33.7 kB 3.36× 152 kB 15.1× 16.1 kB 1.61× 60.5 kB 6.03×
string 547 B 1.00× 17.8 kB 32.5× 1.66 kB 3.03× 69.8 kB 128× 101 kB 184× 8.51 kB 15.6× 148 kB 271× 5.44 kB 9.95× 14.9 kB 27.2×
object_flat 1.72 kB 1.00× 19.0 kB 11.1× 3.75 kB 2.19× 89.2 kB 52.0× 119 kB 69.5× 14.8 kB 8.66× 148 kB 86.4× 8.53 kB 4.98× 45.7 kB 26.6×
object_copy 2.65 kB 1.00× 19.9 kB 7.51× 4.39 kB 1.66× 88.6 kB 33.5× 119 kB 44.8× 15.7 kB 5.91× 148 kB 55.9× 11.6 kB 4.38× 48.9 kB 18.5×
strict_nested 1.86 kB 1.00× 19.1 kB 10.3× 4.05 kB 2.18× 88.6 kB 47.7× 119 kB 63.9× 15.2 kB 8.20× 148 kB 79.9× 9.80 kB 5.28× 27.9 kB 15.0×
pipe 2.90 kB 1.00× 20.1 kB 6.95× 5.33 kB 1.84× 88.5 kB 30.5× 119 kB 40.9× 17.7 kB 6.11× 148 kB 51.1× 8.58 kB 2.96× 32.4 kB 11.2×
union 2.10 kB 1.00× 19.3 kB 9.21× 3.52 kB 1.68× 75.9 kB 36.2× 107 kB 50.8× 13.1 kB 6.26× 148 kB 70.6× 10.1 kB 4.79× 43.7 kB 20.8×
list 2.06 kB 1.00× 19.3 kB 9.38× 4.59 kB 2.23× 89.2 kB 43.4× 119 kB 58.0× 16.7 kB 8.11× 148 kB 72.1× 9.88 kB 4.80× 46.2 kB 22.5×
type_json 4.88 kB 1.00× 22.1 kB 4.53× 8.67 kB 1.78× 93.8 kB 19.2× 124 kB 25.4× 22.6 kB 4.63× 149 kB 30.5× 13.9 kB 2.86× 50.2 kB 10.3×
app 6.30 kB 1.00× 23.6 kB 3.74× 11.1 kB 1.76× 93.6 kB 14.9× 124 kB 19.6× 28.6 kB 4.54× 150 kB 23.8× 14.4 kB 2.29× 53.4 kB 8.47×

Parse time
#

A warm parse of each scenario: on its valid input, on its invalid input, and as a guard, which only answers whether the valid input matches. Each library is timed in a process of its own that holds every scenario, and in another for its guards, the whole repeated in 5 passes of fresh processes. A time is the median of its passes, and the ± beside it is half of what they range over.

Time per call. Each group leads with a geometric mean over the scenarios every library has a figure of, with its band: the mean of the scenarios' fastest passes to the mean of their slowest. Two times of a scenario are compared by the spreads of their passes, and two means by their bands.
scenariofuz_schemamaintainer'sfuz_schema compiledmaintainer'sValibotZodZod compiledZod MiniTypeBoxValitaSury
Parsing valid input
every scenario geometric mean over 9 of 9 rows; `type_json` counts for Zod compiled at the time of Zod, which is what runs where its root comes back uncompiled322 ns 313 ns to 341 ns 4.34× 74.1 ns 71.9 ns to 77.8 ns ≈1.00× 883 ns 860 ns to 905 ns 11.9× 560 ns 538 ns to 620 ns 7.56× 155 ns 152 ns to 171 ns 2.09× 1.15 µs 1.12 µs to 1.17 µs 15.5× 102 ns 100 ns to 105 ns 1.38× 357 ns 344 ns to 375 ns 4.82× 78.7 ns 77.4 ns to 80.2 ns ≈1.06×
string 16.5 ns ±2.3% 1.32× 14.2 ns ±1.8% 1.13× 19.9 ns ±0.8% 1.59× 36.6 ns ±2.8% 2.93× 28.7 ns ±9.5% 2.29× 25.4 ns ±4.5% 2.03× 12.5 ns ±4.7% 1.00× 15.3 ns ±9.5% 1.22× 14.5 ns ±1.5% 1.16×
object_flat 102 ns ±7.8% 6.89× 21.8 ns ±1.9% 1.48× 214 ns ±3.2% 14.5× 64.5 ns ±4.8% 4.37× 30.7 ns ±1.0% 2.08× 383 ns ±1.5% 25.9× 14.8 ns ±1.0% 1.00× 109 ns ±2.2% 7.41× 19.6 ns ±0.3% 1.33×
object_copy 156 ns ±9.5% 10.3× 35.3 ns ±5.5% 2.32× 270 ns ±3.5% 17.8× 143 ns ±8.2% 9.43× 62.0 ns ±4.6% 4.08× 431 ns ±2.0% 28.4× 15.2 ns ±0.5% 1.00× 301 ns ±2.9% 19.8× 31.9 ns ±1.5% 2.10×
strict_nested 160 ns ±2.1% 5.54× 29.0 ns ±1.0% 1.00× 461 ns ±2.1% 15.9× 225 ns ±5.5% 7.78× 49.2 ns ±0.6% 1.70× 682 ns ±1.0% 23.6× 32.1 ns ±0.6% 1.11× 129 ns ±3.0% 4.44× 33.7 ns ±1.8% 1.16×
pipe 139 ns ±5.8% 3.98× 40.5 ns ±6.5% 1.16× 285 ns ±4.9% 8.16× 365 ns ±1.7% 10.5× 52.8 ns ±4.1% 1.52× 583 ns ±2.4% 16.7× 34.9 ns ±1.4% 1.00× 173 ns ±6.4% 4.97× 46.8 ns ±2.3% 1.34×
union 170 ns ±4.4% 8.47× 22.8 ns ±5.1% 1.14× 860 ns ±3.7% 42.9× 719 ns ±6.6% 35.9× 51.1 ns ±6.0% 2.55× 648 ns ±1.5% 32.3× 20.1 ns ±5.4% 1.00× 198 ns ±1.3% 9.87× 22.4 ns ±0.7% 1.11×
list 12.7 µs ±2.2% 8.82× 1.45 µs ±2.2% 1.00× 37.9 µs ±2.1% 26.2× 15.2 µs ±4.9% 10.5× 2.58 µs ±0.6% 1.78× 54.1 µs ±1.1% 37.4× 11.3 µs ±1.1% 7.81× 10.8 µs ±3.6% 7.44× 1.62 µs ±0.9% 1.12×
type_json 1.64 µs ±3.4% 4.52× 362 ns ±4.4% 1.00× 12.3 µs ±0.9% 34.1× 4.25 µs ±33% 11.8× not compiled6.73 µs ±2.1% 18.6× 1.86 µs ±1.3% 5.13× 1.79 µs ±6.3% 4.96× 462 ns ±1.8% 1.28×
app 1.80 µs ±1.8% 4.06× 442 ns ±7.8% ≈1.00× 5.38 µs ±1.5% 12.2× 4.18 µs ±3.1% 9.45× 640 ns ±2.1% 1.45× 8.75 µs ±1.5% 19.8× 914 ns ±2.5% 2.07× 2.23 µs ±3.5% 5.04× 486 ns ±5.1% ≈1.10×
Rejecting invalid input
every scenario geometric mean over 9 of 9 rows; `type_json` counts for Zod compiled at the time of Zod, which is what runs where its root comes back uncompiled417 ns 406 ns to 446 ns 5.41× 404 ns 391 ns to 429 ns 5.23× 1.62 µs 1.57 µs to 1.67 µs 21.0× 2.59 µs 2.46 µs to 2.69 µs 33.6× 2.54 µs 2.43 µs to 2.65 µs 32.9× 3.72 µs 3.61 µs to 3.88 µs 48.2× 77.1 ns 76.3 ns to 78.9 ns 1.00× 368 ns 349 ns to 388 ns 4.77× 517 ns 500 ns to 537 ns 6.70×
string 31.1 ns ±4.5% 2.41× 30.8 ns ±4.2% 2.38× 91.1 ns ±6.7% 7.05× 543 ns ±2.9% 42.0× 526 ns ±4.0% 40.7× 527 ns ±8.8% 40.8× 12.9 ns ±2.3% 1.00× 15.8 ns ±10% 1.23× 141 ns ±7.3% 10.9×
object_flat 142 ns ±7.1% 9.80× 134 ns ±7.7% 9.25× 477 ns ±6.3% 33.0× 771 ns ±5.8% 53.4× 735 ns ±7.5% 50.9× 1.59 µs ±4.5% 110× 14.5 ns ±1.0% 1.00× 139 ns ±8.5% 9.59× 293 ns ±5.5% 20.3×
object_copy 178 ns ±13% 10.9× 187 ns ±1.9% 11.5× 413 ns ±2.6% 25.3× 725 ns ±1.4% 44.4× 798 ns ±5.7% 48.9× 1.29 µs ±4.3% 78.8× 16.3 ns ±1.1% 1.00× 236 ns ±2.5% 14.5× 220 ns ±4.5% 13.4×
strict_nested 246 ns ±4.1% 11.4× 254 ns ±6.9% 11.7× 912 ns ±1.8% 42.1× 1.40 µs ±2.2% 64.4× 1.42 µs ±1.8% 65.3× 2.05 µs ±3.8% 94.8× 21.7 ns ±1.3% 1.00× 164 ns ±6.5% 7.55× 301 ns ±3.1% 13.9×
pipe 173 ns ±5.2% 12.1× 170 ns ±4.1% 11.9× 631 ns ±1.7% 44.2× 1.71 µs ±11% 120× 1.65 µs ±4.0% 116× 2.63 µs ±2.7% 184× 14.3 ns ±1.4% 1.00× 146 ns ±9.2% 10.2× 362 ns ±2.4% 25.3×
union 256 ns ±4.0% 15.9× 223 ns ±9.0% 13.8× 1.79 µs ±2.3% 111× 4.63 µs ±6.6% 287× 4.54 µs ±4.0% 282× 3.45 µs ±2.9% 214× 16.1 ns ±2.7% 1.00× 210 ns ±0.6% 13.0× 282 ns ±3.9% 17.5×
list 13.2 µs ±2.1% 5.08× 13.5 µs ±3.9% 5.21× 39.2 µs ±3.6% 15.1× 19.1 µs ±3.6% 7.38× 20.9 µs ±2.4% 8.06× 58.3 µs ±0.7% 22.5× 5.60 µs ±0.7% 2.16× 11.1 µs ±2.4% 4.29× 2.59 µs ±2.1% 1.00×
type_json 1.69 µs ±1.0% 1.25× 1.98 µs ±3.0% 1.45× 16.7 µs ±0.9% 12.3× 9.69 µs ±5.7% 7.13× not compiled8.29 µs ±2.3% 6.09× 1.36 µs ±0.5% 1.00× 1.81 µs ±4.5% 1.33× 2.51 µs ±0.4% 1.85×
app 2.02 µs ±2.7% 2.42× 1.43 µs ±1.4% 1.72× 6.35 µs ±2.0% 7.62× 8.37 µs ±1.9% 10.0× 6.53 µs ±4.1% 7.83× 13.9 µs ±2.7% 16.7× 833 ns ±4.0% 1.00× 2.34 µs ±3.6% 2.81× 1.44 µs ±3.2% 1.73×
Answering only whether it matches
every scenario geometric mean over 9 of 9 rows; `type_json` counts for Zod compiled at the time of Zod, which is what runs where its root comes back uncompiled308 ns 302 ns to 331 ns 5.55× 55.5 ns 55.1 ns to 56.5 ns 1.00× 861 ns 839 ns to 881 ns 15.5× 488 ns 477 ns to 503 ns 8.78× 116 ns 115 ns to 157 ns 2.08× 1.17 µs 1.15 µs to 1.20 µs 21.1× 99.3 ns 97.9 ns to 108 ns 1.79× 360 ns 342 ns to 378 ns 6.49× 58.1 ns 57.7 ns to 59.4 ns 1.05×
string 14.6 ns ±22% 1.73× 8.45 ns ±0.3% ≈1.00× 17.3 ns ±1.7% 2.05× 27.6 ns ±0.3% 3.27× 20.2 ns ±31% 2.40× 27.6 ns ±0.9% 3.27× 12.1 ns ±11% 1.44× 15.4 ns ±8.2% 1.83× 8.44 ns ±0.1% ≈1.00×
object_flat 95.4 ns ±1.1% 8.78× 10.9 ns ±0.5% 1.00× 204 ns ±1.6% 18.8× 50.3 ns ±1.2% 4.63× 21.4 ns ±40% 1.97× 403 ns ±3.9% 37.1× 14.4 ns ±8.6% 1.32× 111 ns ±3.9% 10.2× 11.7 ns ±0.3% 1.08×
object_copy 151 ns ±7.4% 10.8× 22.0 ns ±0.4% 1.56× 259 ns ±1.8% 18.4× 117 ns ±3.8% 8.29× 46.3 ns ±28% 3.29× 445 ns ±1.9% 31.7× 14.1 ns ±7.0% 1.00× 304 ns ±4.8% 21.6× 22.9 ns ±0.5% 1.63×
strict_nested 148 ns ±0.5% 6.34× 23.4 ns ±3.6% 1.00× 443 ns ±2.4% 18.9× 211 ns ±4.7% 9.02× 33.8 ns ±21% 1.44× 727 ns ±2.8% 31.0× 31.7 ns ±1.5% 1.35× 131 ns ±4.4% 5.59× 24.4 ns ±0.2% 1.04×
pipe 137 ns ±4.8% 4.45× 30.7 ns ±0.6% 1.00× 287 ns ±3.7% 9.34× 344 ns ±3.5% 11.2× 40.6 ns ±17% 1.32× 593 ns ±3.5% 19.3× 34.6 ns ±1.2% 1.13× 171 ns ±5.8% 5.58× 32.1 ns ±1.1% 1.04×
union 168 ns ±5.6% 10.3× 17.4 ns ±0.5% 1.07× 892 ns ±3.4% 55.0× 526 ns ±3.1% 32.4× 40.1 ns ±3.0% 2.47× 534 ns ±2.3% 32.9× 18.8 ns ±11% 1.16× 183 ns ±5.9% 11.3× 16.2 ns ±0.7% 1.00×
list 12.4 µs ±1.3% 8.99× 1.38 µs ±0.3% ≈1.00× 37.0 µs ±3.5% 26.9× 14.7 µs ±3.7% 10.7× 1.50 µs ±17% ≈1.09× 59.4 µs ±2.4% 43.2× 11.4 µs ±1.0% 8.33× 11.0 µs ±4.1% 8.01× 1.42 µs ±0.4% 1.03×
type_json 1.56 µs ±1.0% 4.36× 357 ns ±2.9% 1.00× 12.3 µs ±1.9% 34.5× 4.31 µs ±2.1% 12.1× not compiled6.96 µs ±1.6% 19.5× 1.81 µs ±2.0% 5.07× 1.81 µs ±6.8% 5.08× 442 ns ±8.1% 1.24×
app 1.82 µs ±1.4% 4.47× 406 ns ±2.5% ≈1.00× 5.49 µs ±1.9% 13.5× 3.99 µs ±2.4% 9.83× 524 ns ±17% 1.29× 8.99 µs ±2.5% 22.1× 898 ns ±3.6% 2.21× 2.39 µs ±1.3% 5.90× 421 ns ±2.2% ≈1.04×
  • fuz_schema: A strict or identity parse of valid input returns the input itself, where Valibot and Zod return a copy.
  • fuz_schema compiled: Each schema through compile_parse, whose compiled code builds what parse returns for a valid input: the input itself where nothing changed. Compiled code builds no issue: an invalid input is handed to parse, so a figure is the interpreter's parse after the compiled code has run to its first failure. Each schema through compile_guard, which gives what is gives.
  • Valibot: Its guard, is, runs the parser, which copies what it reads, and drops the copy.
  • Zod: Classic zod generates a parser for each object schema on its first parse where the environment allows eval. Its guard, z.validate, runs the parser where a schema has no compiled path, which copies what it reads, and drops the copy.
  • Zod compiled: Each root through z.compile, which generates its parser and its validator ahead of time. A root it hands back uncompiled has no timed figure. Each root through z.compile, which hands an invalid input to Zod's regular parser. A root it hands back uncompiled has no timed figure.
  • Zod Mini: Its objects never compile: zod/mini has no generated parser. Its guard, z.validate, runs the parser where a schema has no compiled path, which copies what it reads, and drops the copy.
  • TypeBox: Every row is a Check of its compiled validator, which stops at the first failure and builds no issues and no output.
  • Valita: As this library does, it hands back a valid input that needs no change, and builds no copy of it. It has no guard of its own: its row is its parse.
  • Sury: Each row is an operation it generates with new Function, parseAsResult for a parse and isInput for a guard, compiled as the schema is built. A parse of valid input returns a new object with every key of its schema, an optional key the input lacks among them, with no value.

Cold start
#

What a fresh Node process pays before it has validated anything: one process a sample, in stages that each include the ones before, timed inside the process from its module's first line, as the median of 15 samples. A bundled entry is the minified chunk a bundler makes of one scenario, and an unbundled one imports the package from node_modules, as a server without a bundler does.

Each group shows the work up to a first parse. Open one for every stage, the parses after the first, and what the process added over a bare one. A figure is the median of its samples and is compared by half of their p10 to p90 band, the ± beside it.
work inside a fresh processfuz_schemamaintainer'sfuz_schema compiledmaintainer'sValibotZodZod compiledZod MiniTypeBoxValitaSury
object_flat, bundled
and parse once 0.62 ms ±2.9% 1.00× 2.87 ms ±1.4% 4.61× 0.70 ms ±3.1% 1.12× 11.6 ms ±17% 18.6× 13.2 ms ±3.9% 21.2× 2.27 ms ±1.5% 3.65× 11.2 ms ±2.7% 18.1× 1.25 ms ±1.7% 2.01× 6.11 ms ±1.7% 9.83×
object_flat, unbundled
and parse once 1.72 ms ±2.6% 1.00× 4.64 ms ±2.3% 2.70× 4.60 ms ±0.6% 2.67× 44.2 ms ±1.4% 25.7× 44.6 ms ±3.9% 25.9× 40.5 ms ±4.3% 23.5× 134 ms ±1.1% 77.9× 2.73 ms ±1.1% 1.58× 42.3 ms ±1.5% 24.6×
type_json, bundled
and parse once 1.10 ms ±2.3% 1.00× 4.12 ms ±0.9% 3.74× 1.79 ms ±2.4% 1.62× 17.0 ms ±2.2% 15.4× 17.6 ms ±2.8% 15.9× 4.82 ms ±1.7% 4.37× 21.4 ms ±1.8% 19.4× 2.81 ms ±1.8% 2.55× 15.0 ms ±13% 13.6×
type_json, unbundled
and parse once 2.16 ms ±1.6% 1.00× 5.92 ms ±1.1% 2.75× 5.70 ms ±1.0% 2.65× 48.9 ms ±1.9% 22.7× 48.7 ms ±5.1% 22.6× 42.9 ms ±5.3% 19.9× 141 ms ±1.1% 65.2× 4.21 ms ±0.7% 1.95× 46.9 ms ±1.0% 21.8×
app, bundled
and parse once 1.34 ms ±1.8% 1.00× 5.38 ms ±0.7% 4.03× 1.90 ms ±1.3% 1.42× 20.5 ms ±2.4% 15.4× 21.1 ms ±2.4% 15.8× 6.20 ms ±1.7% 4.64× 15.3 ms ±1.3% 11.5× 3.18 ms ±0.7% 2.38× 13.7 ms ±16% 10.2×
app, unbundled
and parse once 2.40 ms ±0.9% 1.00× 7.16 ms ±1.8% 2.98× 5.88 ms ±2.4% 2.45× 51.5 ms ±4.4% 21.5× 52.5 ms ±4.5% 21.8× 44.4 ms ±5.6% 18.5× 139 ms ±1.1% 57.7× 4.66 ms ±2.4% 1.94× 48.2 ms ±1.3% 20.1×
  • fuz_schema compiled: It carries the compiler of compile.ts, and compiles while the schema is built.
  • Zod: Classic zod generates a parser for each object schema on its first parse where the environment allows eval.
  • Zod compiled: It carries the compiler z.compile needs, and compiles while the schema is built.
  • Sury: It carries its compiler, and compiles while the schema is built.
Building a scenario's schema again in a warm process, timed once in one process a library. One timing has no measure of what it ranges over, so the figures are shown and not compared.
scenariofuz_schemamaintainer'sfuz_schema compiledmaintainer'sValibotZodZod compiledZod MiniTypeBoxValitaSury
Building a schema, warm one timing in one process a library: shown, not compared
string 14.1 ns 10.0 µs 50.9 ns 925 ns 27.6 µs 690 ns 17.3 µs 13.7 ns 39.0 ns
object_flat 81.3 ns 31.6 µs 301 ns 6.68 µs 91.9 µs 5.41 µs 48.4 µs 56.7 ns 53.0 µs
object_copy 163 ns 40.6 µs 510 ns 10.9 µs 110 µs 7.67 µs 55.0 µs 169 ns 117 µs
strict_nested 116 ns 30.8 µs 371 ns 10.4 µs 116 µs 8.44 µs 63.4 µs 79.0 ns 58.3 µs
pipe 346 ns 41.5 µs 564 ns 24.8 µs 125 µs 9.93 µs 54.4 µs 253 ns 47.1 µs
union 67.7 ns 17.5 µs 323 ns 4.33 µs 66.1 µs 3.83 µs 31.0 µs 59.8 ns 45.4 µs
list 116 ns 31.0 µs 401 ns 9.82 µs 139 µs 8.33 µs 65.0 µs 106 ns 76.9 µs
type_json 1.42 µs 149 µs 2.87 µs 79.0 µs 91.4 µs 65.3 µs 976 µs 1.14 µs 501 µs
app 2.28 µs 422 µs 6.03 µs 165 µs 1.51 ms 105 µs 847 µs 1.90 µs 941 µs
  • fuz_schema compiled: It carries the compiler of compile.ts, and compiles while the schema is built.
  • Zod compiled: It carries the compiler z.compile needs, and compiles while the schema is built.
  • Sury: It carries its compiler, and compiles while the schema is built.

Memory
#

What a parse allocates, and what a library still holds once its schemas are built. Allocation is the growth of V8's heap across a sample of calls, with no collection forced. It is exact for the code the engine is running when it is sampled, and which code that is is settled per process, and not always the same way: a row repeats within about a percent from process to process, and can settle at one of a few figures, tens of bytes to a couple of kilobytes apart, each process at one of them.

Heap bytes per call, one figure a process. Two figures are compared with 1.0% either side of each, what a row repeats within: two closer than that are level.
scenariofuz_schemamaintainer'sfuz_schema compiledmaintainer'sValibotZodZod compiledZod MiniTypeBoxValitaSury
A parse of valid input
string 0 B 0 B 72.0 B 144.0 B 40 B 144.0 B 0 B 0 B 56 B
object_flat 88.0 B 40 B 416.1 B 328.1 B 96.0 B 1.05 kB 0 B 40 B 120.0 B
object_copy 176.0 B 128.0 B 448.1 B 488.1 B 224.0 B 1.00 kB 0 B 288.0 B 144.0 B
strict_nested 88.0 B 2.20× 40 B 1.00× 1.09 kB 27.2× 912.1 B 22.8× 216.0 B 5.40× 1.82 kB 45.6× 152.0 B 3.80× 80.0 B 2.00× 56 B 1.40×
pipe 88.0 B 40 B 360.1 B 864.2 B 88.0 B 1.21 kB 0 B 136.0 B 104.0 B
union 88.0 B 40 B 4.56 kB 4.51 kB 152 B 4.51 kB 0 B 40 B 56 B
list 88.0 B 2.20× 40 B 1.00× 85.4 kB 2,135× 60.6 kB 1,515× 16.1 kB 402× 138 kB 3,455× 15.0 kB 375× 120.0 B 3.00× 56 B 1.40×
type_json 88.0 B 2.20× 40 B ≈1.00× 41.4 kB 1,034× 8.94 kB 223× 9.14 kB 228× 14.2 kB 356× 3.30 kB 82.6× 40 B ≈1.00× 56 B 1.40×
app 880.1 B 2.20× 400.0 B 1.00× 9.19 kB 23.0× 10.7 kB 26.7× 1.70 kB 4.24× 18.0 kB 45.1× 1.65 kB 4.12× 872.0 B 2.18× 560.1 B 1.40×
A parse of invalid input
string 152.0 B 96.0 B 472.0 B 816.3 B 816.6 B 816.3 B 0 B 0 B 456.1 B
object_flat 616.0 B 616.0 B 1.59 kB 1.53 kB 1.53 kB 2.86 kB 0 B 224.0 B 856.1 B
object_copy 384.1 B 416.1 B 952.0 B 1.38 kB 1.51 kB 2.20 kB 0 B 280.0 B 592.0 B
strict_nested 952.3 B 11.9× 952.3 B 11.9× 2.63 kB 32.9× 3.14 kB 39.3× 3.22 kB 40.2× 4.22 kB 52.7× 80.0 B 1.00× 376.1 B 4.70× 832.2 B 10.4×
pipe 768.1 B 768.1 B 1.90 kB 2.45 kB 2.45 kB 3.70 kB 0 B 432.1 B 992.1 B
union 616.0 B 616.0 B 8.54 kB 10.8 kB 10.9 kB 10.2 kB 0 B 224.0 B 888.1 B
list 2.23 kB 1.86× 2.23 kB 1.86× 89.9 kB 74.9× 67.1 kB 55.9× 79.6 kB 66.3× 145 kB 121× 7.67 kB 6.39× 1.20 kB 1.00× 2.39 kB 1.99×
type_json 464.1 B 1.18× 464.1 B 1.18× 55.2 kB 141× 13.8 kB 35.3× 14.0 kB 35.8× 17.0 kB 43.3× 2.51 kB 6.41× 392.1 B 1.00× 1.46 kB 3.71×
app 2.09 kB 1.70× 1.85 kB 1.50× 11.9 kB 9.63× 16.4 kB 13.3× 10.7 kB 8.67× 24.4 kB 19.8× 1.49 kB 1.21× 1.23 kB 1.00× 3.03 kB 2.46×
Building a schema
string 96.0 B ≈1.00× 8.67 kB 90.3× 416.1 B 4.33× 1.28 kB 13.3× 11.9 kB 124× 968.2 B 10.1× 7.24 kB 75.4× 96.0 B ≈1.00× 96.0 B ≈1.00×
object_flat 672.1 B 2.10× 26.0 kB 81.4× 2.47 kB 7.73× 9.71 kB 30.3× 66.8 kB 209× 7.62 kB 23.8× 22.8 kB 71.3× 320.0 B 1.00× 39.5 kB 123×
object_copy 1.30 kB 1.39× 29.7 kB 31.7× 3.34 kB 3.56× 14.4 kB 15.3× 69.7 kB 74.4× 10.1 kB 10.8× 27.4 kB 29.3× 936.2 B 1.00× 63.3 kB 67.6×
strict_nested 968.4 B 2.09× 24.5 kB 52.7× 3.11 kB 6.69× 15.7 kB 33.8× 86.4 kB 186× 11.7 kB 25.3× 31.7 kB 68.3× 464.1 B 1.00× 44.8 kB 96.5×
pipe 1.96 kB 1.04× 36.4 kB 19.4× 3.74 kB 1.99× 27.7 kB 14.7× 74.7 kB 39.7× 13.1 kB 6.97× 21.2 kB 11.3× 1.88 kB 1.00× 30.3 kB 16.1×
union 520.1 B 1.44× 14.7 kB 40.9× 2.32 kB 6.44× 6.10 kB 16.9× 48.5 kB 135× 5.11 kB 14.2× 14.1 kB 39.1× 360.1 B 1.00× 27.3 kB 75.8×
list 985.5 B 1.64× 24.4 kB 40.7× 3.46 kB 5.76× 14.6 kB 24.3× 105 kB 175× 11.3 kB 18.7× 32.6 kB 54.3× 600.1 B 1.00× 57.5 kB 95.8×
type_json 10.4 kB 2.26× 210 kB 45.5× 22.5 kB 4.89× 115 kB 25.0× 125 kB 27.1× 87.2 kB 18.9× 922 kB 200× 4.61 kB 1.00× 592 kB 128×
app 15.2 kB 1.54× 337 kB 34.1× 36.2 kB 3.67× 198 kB 20.1× 1.04 MB 105× 132 kB 13.4× 373 kB 37.8× 9.87 kB 1.00× 627 kB 63.5×
  • fuz_schema: A strict or identity parse of valid input returns the input itself, where Valibot and Zod return a copy.
  • fuz_schema compiled: Each schema through compile_parse, whose compiled code builds what parse returns for a valid input: the input itself where nothing changed. Compiled code builds no issue: an invalid input is handed to parse, so a figure is the interpreter's parse after the compiled code has run to its first failure. It carries the compiler of compile.ts, and compiles while the schema is built.
  • Zod compiled: It carries the compiler z.compile needs, and compiles while the schema is built.
  • TypeBox: Every row is a Check of its compiled validator, which stops at the first failure and builds no issues and no output.
  • Valita: As this library does, it hands back a valid input that needs no change, and builds no copy of it.
  • Sury: A parse of valid input returns a new object with every key of its schema, an optional key the input lacks among them, with no value. It carries its compiler, and compiles while the schema is built.

Retained heap is read in a fresh process that builds a scenario's schema, parses once, and collects until the heap settles, over a bare process holding the same input. The figures depend on Node's version and the machine's architecture.

Bytes held, in decimal units, where the script prints its own in units of 1,024. The first group carries each library's own fixed memory, and the second is what an app that defines many schemas pays for each. A total is compared with 1.00 kB either side of it and a figure per further schema with 2 B, what each repeats to.
scenariofuz_schemamaintainer'sfuz_schema compiledmaintainer'sValibotZodZod compiledZod MiniTypeBoxValitaSury
Held after one schema is built and has parsed once
object_flat 33.0 kB 1.00× 141 kB 4.29× 42.6 kB 1.29× 739 kB 22.4× 817 kB 24.8× 167 kB 5.06× 1.07 MB 32.4× 102 kB 3.09× 295 kB 8.95×
type_json 77.6 kB 1.00× 257 kB 3.31× 131 kB 1.69× 1.10 MB 14.2× 1.16 MB 15.0× 402 kB 5.18× 1.46 MB 18.8× 240 kB 3.10× 804 kB 10.4×
Each further schema read between processes holding 50 schemas and 250
object_flat 693 B 1.00× 2.44 kB 3.51× 2.50 kB 3.60× 13.4 kB 19.3× 11.0 kB 15.8× 4.79 kB 6.91× 5.79 kB 8.35× 1.74 kB 2.51× 12.7 kB 18.4×
type_json 10.0 kB 1.00× 17.3 kB 1.72× 21.9 kB 2.19× 131 kB 13.1× 131 kB 13.1× 57.1 kB 5.71× 135 kB 13.4× 25.2 kB 2.52× 233 kB 23.3×
  • fuz_schema compiled: It carries the compiler of compile.ts, and compiles while the schema is built.
  • Zod compiled: It carries the compiler z.compile needs, and compiles while the schema is built.
  • Sury: It carries its compiler, and compiles while the schema is built.

Type-checking cost
#

What each library's types cost the TypeScript checker (6.0.3): tsc over one module of every scenario, and over a file that reads properties of the types the schemas infer, as a consumer's code does. Instantiations are the same on every run. The scenarios are small, so this ranks the libraries and doesn't predict a large codebase.

The reads are t.string.length, t.object_flat.name, t.object_flat.role, t.strict_nested.address.city, t.strict_nested.tags[0], t.pipe.slug, t.union[0], t.list[0]?.email. Instantiations are exact, so any gap is a difference, and check time is shown and not compared.
measurefuz_schemamaintainer'sfuz_schema compiledmaintainer'sValibotZodZod compiledZod MiniTypeBoxValitaSury
instantiations, a module of every scenario 10,876 1.63× 11,057 1.66× 27,596 4.14× 110,920 16.6× 111,099 16.7× 16,981 2.55× 6,662 1.00× 23,183 3.48× 63,720 9.56×
instantiations, the schemas with a consumer's reads of what they infer 9,498 1.00× 9,730 1.02× 24,408 2.57× 93,944 9.89× 111,275 11.7× 11,184 1.18× 12,463 1.31× 19,607 2.06× 62,375 6.57×
check time, a module of every scenario the median of 3 runs, which moves from run to run: shown, not compared0.14 s 0.14 s 0.23 s 0.47 s 0.48 s 0.17 s 0.15 s 0.17 s 0.33 s
  • fuz_schema compiled: Its module calls compile_parse on each schema, and its reads are of what a compiled parse gives: the interpreter's types and what the compile's add.

Survey
#

The scenarios give a library one figure for a match and one for a miss, on a few schemas, and a library that is ahead on one kind of work can hide in them. The survey times many small shapes, a row for each input of each, and summarizes them by what a parse does.

The time of fuz_schemamaintainer's over that of each other column, as a geometric mean over the rows of one kind of work: under 1.00× it is the faster of the two, and over it the other is. A mean marked ≈ has 1.00× inside what its rows' spreads let it range over, printed under it, and names neither. Beside each mean is how many of the rows the other is ahead on, by more than the two spreads together.
what a parse doesrowsover fuz_schema compiledmaintainer'sover Valibotover Zodover Zod compiled
primitive91.21× 1.18× to 1.24× ahead on 8 of 80.78× 0.76× to 0.79× ahead on 0 of 90.44× 0.42× to 0.45× ahead on 0 of 90.63× 0.62× to 0.65× ahead on 0 of 9
wrapper123.11× 3.05× to 3.17× ahead on 12 of 120.63× 0.62× to 0.64× ahead on 0 of 120.37× 0.36× to 0.38× ahead on 0 of 121.36× 1.33× to 1.39× ahead on 5 of 12
guard21.07× 1.05× to 1.09× ahead on 2 of 20.34× 0.33× to 0.34× ahead on 0 of 20.42× 0.42× to 0.43× ahead on 0 of 20.98× 0.97× to 0.99× ahead on 0 of 2
array44.11× 4.00× to 4.23× ahead on 4 of 40.48× 0.47× to 0.50× ahead on 0 of 40.30× 0.30× to 0.31× ahead on 0 of 41.82× 1.78× to 1.85× ahead on 3 of 4
record2≈1.02× 0.96× to 1.08× ahead on 1 of 20.45× 0.42× to 0.48× ahead on 0 of 20.22× 0.20× to 0.24× ahead on 0 of 20.34× 0.32× to 0.36× ahead on 0 of 2
object identity223.65× 3.51× to 3.79× ahead on 22 of 220.40× 0.38× to 0.42× ahead on 0 of 220.53× 0.50× to 0.57× ahead on 0 of 221.96× 1.87× to 2.04× ahead on 21 of 22
object copy45.54× 5.19× to 5.92× ahead on 4 of 40.65× 0.61× to 0.70× ahead on 0 of 41.24× 1.13× to 1.36× ahead on 2 of 43.06× 2.91× to 3.22× ahead on 4 of 4
union83.22× 3.11× to 3.34× ahead on 8 of 80.27× 0.26× to 0.28× ahead on 0 of 80.30× 0.29× to 0.31× ahead on 0 of 81.45× 1.42× to 1.49× ahead on 5 of 8
variant23.01× 2.94× to 3.08× ahead on 2 of 20.17× 0.16× to 0.17× ahead on 0 of 20.62× 0.57× to 0.67× ahead on 0 of 21.66× 1.61× to 1.71× ahead on 2 of 2
pipe72.20× 2.14× to 2.27× ahead on 7 of 70.60× 0.54× to 0.66× ahead on 0 of 70.30× 0.28× to 0.34× ahead on 0 of 71.23× 1.19× to 1.28× ahead on 4 of 7
lazy44.31× 4.17× to 4.45× ahead on 4 of 40.35× 0.34× to 0.37× ahead on 0 of 40.29× 0.28× to 0.30× ahead on 0 of 41.03× 1.00× to 1.06× ahead on 2 of 3
issue at the root271.06× 1.02× to 1.11× ahead on 13 of 270.30× 0.29× to 0.31× ahead on 0 of 270.05× 0.05× to 0.06× ahead on 0 of 270.05× 0.05× to 0.06× ahead on 0 of 27
issue at depth 1200.93× 0.88× to 0.98× ahead on 0 of 200.28× 0.27× to 0.30× ahead on 0 of 200.11× 0.10× to 0.12× ahead on 0 of 200.11× 0.10× to 0.13× ahead on 0 of 20
issue at depth 22≈0.95× 0.90× to 1.01× ahead on 0 of 20.31× 0.30× to 0.32× ahead on 0 of 20.23× 0.22× to 0.24× ahead on 0 of 20.26× 0.24× to 0.27× ahead on 0 of 2
issue at depth 420.94× 0.90× to 0.98× ahead on 0 of 20.26× 0.26× to 0.27× ahead on 0 of 20.09× 0.08× to 0.10× ahead on 0 of 20.13× 0.11× to 0.15× ahead on 0 of 1
issue at depth 820.91× 0.89× to 0.94× ahead on 0 of 20.26× 0.26× to 0.27× ahead on 0 of 20.15× 0.13× to 0.17× ahead on 0 of 20.14× 0.12× to 0.16× ahead on 0 of 2
many issues12≈1.02× 0.98× to 1.07× ahead on 4 of 120.26× 0.25× to 0.27× ahead on 0 of 120.14× 0.13× to 0.16× ahead on 0 of 120.16× 0.14× to 0.18× ahead on 0 of 12
every row1411.76× 1.69× to 1.83× ahead on 91 of 1400.37× 0.36× to 0.39× ahead on 0 of 1410.20× 0.19× to 0.22× ahead on 2 of 1410.39× 0.37× to 0.42× ahead on 46 of 139
Every row, time per call, by what its parse does, compared by the spreads of its passes. A time at or under 7.87 ns, twice what a function that does nothing took through the timing loop, is at the call floor.
shape and inputfuz_schemamaintainer'sfuz_schema compiledmaintainer'sValibotZodZod compiled
primitive
wrapper
guard
array
record
object identity
object copy
union
variant
pipe
lazy
issue at the root
issue at depth 1
issue at depth 2
issue at depth 4
issue at depth 8
many issues
  • fuz_schema: A strict or identity parse of valid input returns the input itself, where Valibot and Zod return a copy.
  • fuz_schema compiled: Each schema through compile_parse, whose compiled code builds what parse returns for a valid input: the input itself where nothing changed. Compiled code builds no issue: an invalid input is handed to parse, so a figure is the interpreter's parse after the compiled code has run to its first failure. Each schema through compile_guard, which gives what is gives.
  • Valibot: Its guard, is, runs the parser, which copies what it reads, and drops the copy.
  • Zod: Classic zod generates a parser for each object schema on its first parse where the environment allows eval. Its guard, z.validate, runs the parser where a schema has no compiled path, which copies what it reads, and drops the copy.
  • Zod compiled: Each root through z.compile, which generates its parser and its validator ahead of time. A root it hands back uncompiled has no timed figure. Each root through z.compile, which hands an invalid input to Zod's regular parser. A root it hands back uncompiled has no timed figure.

Harvested sets
#

A harvested set is a consumer's own schemas and its own data, copied in as a snapshot: the schemas as the consumer wrote them, in Valibot or Zod, against the same schemas in this library, on that set's documents. Every row is held to one verdict and one output on both sides before it is measured.

docinfo
#

svelte-docinfo's analysis output, in valibot and in this library.

The bundle of a module that parses one document, then time per parse and heap bytes per parse over the set's documents, each summarized as a geometric mean over the rows every side has a number of. Open a group for its rows. Bundle bytes are exact, times are compared by the spreads of their passes, and heap bytes with 1.0% either side of each.
rowValibotfuz_schemamaintainer's
A module that parses one ModuleJson
minified and gzipped 3.84 kB 1.25× 3.07 kB 1.00×
Parse time
every row geometric mean over 7 of 7 rows422 µs 416 µs to 428 µs 2.83× 149 µs 147 µs to 152 µs 1.00×
Heap bytes a parse allocates
every row geometric mean over 7 of 7 rows1.12 MB 1.11 MB to 1.13 MB 448× 2.50 kB 2.47 kB to 2.52 kB 1.00×
  • fuz_schema: A strict or identity parse of valid input returns the input itself, where Valibot and Zod return a copy.

repos_status
#

fuz_repos's status report, in zod and in this library.

The bundle of a module that parses one document, then time per parse and heap bytes per parse over the set's documents, each summarized as a geometric mean over the rows every side has a number of. Open a group for its rows. Bundle bytes are exact, times are compared by the spreads of their passes, and heap bytes with 1.0% either side of each.
rowZodZod jitlessZod compiledfuz_schemamaintainer's
A module that parses one ReposStatusDocument
minified and gzipped 27.1 kB 6.65× no bundle of its own34.2 kB 8.40× 4.07 kB 1.00×
Parse time
every row geometric mean over 5 of 5 rows34.9 µs 33.9 µs to 35.9 µs 2.94× 125 µs 123 µs to 127 µs 10.5× 11.9 µs 10.4 µs to 13.2 µs 1.00× 22.4 µs 21.8 µs to 22.9 µs 1.88×
Heap bytes a parse allocates
every row geometric mean over 5 of 5 rows99.0 kB 98.0 kB to 99.9 kB 1,038× 243 kB 241 kB to 246 kB 2,550× 22.9 kB 22.6 kB to 23.1 kB 240× 95.4 B 94.4 B to 96.3 B 1.00×
  • Zod: Classic zod generates a parser for each object schema on its first parse where the environment allows eval.
  • Zod compiled: Each root through z.compile, which generates its parser and its validator ahead of time. A root it hands back uncompiled has no timed figure. Each root through z.compile, which hands an invalid input to Zod's regular parser. A root it hands back uncompiled has no timed figure. It carries the compiler z.compile needs, and compiles while the schema is built.
  • fuz_schema: A strict or identity parse of valid input returns the input itself, where Valibot and Zod return a copy.

package_json
#

fuz_util's package.json, in zod and in this library.

The bundle of a module that parses one document, then time per parse and heap bytes per parse over the set's documents, each summarized as a geometric mean over the rows every side has a number of. Open a group for its rows. Bundle bytes are exact, times are compared by the spreads of their passes, and heap bytes with 1.0% either side of each.
rowZodZod jitlessZod compiledfuz_schemamaintainer's
A module that parses one PackageJson
minified and gzipped 24.7 kB 11.0× no bundle of its own31.8 kB 14.2× 2.24 kB 1.00×
Parse time
every row geometric mean over 0 of 7 rowsno row has a number that can be compared for every library shown
Heap bytes a parse allocates
every row geometric mean over 0 of 7 rowsno row has a number that can be compared for every library shown
  • Zod: Classic zod generates a parser for each object schema on its first parse where the environment allows eval.
  • Zod compiled: Each root through z.compile, which generates its parser and its validator ahead of time. A root it hands back uncompiled has no timed figure. Each root through z.compile, which hands an invalid input to Zod's regular parser. A root it hands back uncompiled has no timed figure. It carries the compiler z.compile needs, and compiles while the schema is built.
  • fuz_schema: A strict or identity parse of valid input returns the input itself, where Valibot and Zod return a copy.

Not all of a parse here is a library. Timed alone, in a process of their own: the URL checks of 'published, one', as the rewrite writes them, 394 ns and 168.3 B.

bench_results
#

syntax-highlighter-bench's results document, in zod and in this library.

The bundle of a module that parses one document, then time per parse and heap bytes per parse over the set's documents, each summarized as a geometric mean over the rows every side has a number of. Open a group for its rows. Bundle bytes are exact, times are compared by the spreads of their passes, and heap bytes with 1.0% either side of each.
rowZodZod jitlessZod compiledfuz_schemamaintainer's
A module that parses one BenchResults
minified and gzipped 27.2 kB 7.16× no bundle of its own34.3 kB 9.03× 3.79 kB 1.00×
Parse time
every row geometric mean over 3 of 3 rows412 µs 397 µs to 427 µs 3.94× 740 µs 730 µs to 750 µs 7.08× 104 µs 101 µs to 108 µs 1.00× 146 µs 142 µs to 150 µs 1.39×
Heap bytes a parse allocates
every row geometric mean over 3 of 3 rows1.07 MB 1.06 MB to 1.08 MB 82.4× 1.46 MB 1.45 MB to 1.48 MB 113× 160 kB 158 kB to 161 kB 12.3× 13.0 kB 12.8 kB to 13.1 kB 1.00×
  • Zod: Classic zod generates a parser for each object schema on its first parse where the environment allows eval.
  • Zod compiled: Each root through z.compile, which generates its parser and its validator ahead of time. A root it hands back uncompiled has no timed figure. Each root through z.compile, which hands an invalid input to Zod's regular parser. A root it hands back uncompiled has no timed figure. It carries the compiler z.compile needs, and compiles while the schema is built.
  • fuz_schema: A strict or identity parse of valid input returns the input itself, where Valibot and Zod return a copy.

How it was measured
#

Measured on laptop1 (AMD Ryzen 5 PRO 7530U with Radeon Graphics), Node v26.13.0, V8 14.6.202.34-node.40, on 2026-11-23, at commit 6cf7a82b43.

libraries

  • fuz_schema: @fuzdev/fuz_schema 0.6.1. This repository's source at the run's commit, not the published package of that version.
  • fuz_schema compiled: @fuzdev/fuz_schema 0.6.1. This repository's source at the run's commit, with each schema through compile_parse, or compile_guard for a guard: fuz_schema in its compiled mode, and no other library.
  • Valibot: valibot 1.5.0
  • Zod: zod 4.6.6
  • Zod compiled: zod 4.6.6. Zod with each root through z.compile, its ahead-of-time mode.
  • Zod Mini: zod 4.6.6. zod/mini.
  • TypeBox: typebox 1.3.36. The Check of its compiled validator.
  • Valita: @badrap/valita 0.5.5
  • Sury: sury 11.1.0

tools

  • rolldown 1.2.19
  • typescript 6.0.3

the machine

  • as the run started: load 0.48 0.26 0.09, CPUs at 1095 to 4470 MHz, performance governor, amd-pstate-epp driver, energy preference performance, boost on
  • as it ended: load 1.40 1.35 1.09, CPUs at 3509 to 4391 MHz, performance governor, amd-pstate-epp driver, energy preference performance, boost on
  • the run took 23.4 min
What each script was started with
  • npm run benchmark:bundle, which runs gro run src/benchmarks/bundle.ts, in 7 s
  • npm run benchmark:types, which runs gro run src/benchmarks/types.ts, in 80 s
  • npm run benchmark:allocations, which runs node --min-semi-space-size=64 --max-semi-space-size=64 src/benchmarks/allocations.ts, in 4.1 min
  • npm run benchmark:heap, which runs gro run src/benchmarks/run_heap.ts, in 9 s
  • npm run benchmark:coldstart, which runs gro run src/benchmarks/run_coldstart.ts, in 3.8 min
  • npm run benchmark, which runs node src/benchmarks/run.ts, in 4.9 min
  • npm run benchmark:survey, which runs node src/benchmarks/survey.ts, in 4.7 min
  • npm run benchmark:harvest, which runs node src/benchmarks/harvest.ts, in 4.3 min
  • Bundle bytes and instantiations are exact. Bundle sizes and tsc's instantiations are the same on any machine for the same sources and tools. Allocation is exact for the code the engine is running, which a process settles and not always the same way, so a row repeats within about a percent, and a retained total to about a kilobyte: the tables compare each with that much either side.
  • Times are one machine's. They come from the machine named above, on one version of Node, with nothing pinned or isolated: what it was doing as the run started and ended is above. Compare the ratios between libraries before the absolute times, and read a gap against the spreads beside it: one inside them is not a finding, and one just outside is not much of one.
  • A process holds one library. What a library takes depends on what its process ran before, so no two share one, and a figure is what a library takes with the engine's attention to itself.
  • The scenarios are few and small, and all but one are synthetic. A test holds every library to the same answer on each scenario's inputs, so the rows compare the same question, not the same work: what each library builds on the way to its answer differs, as the notes above say.
  • It is V8 only. No other engine is measured.

The benchmarks' documentation has the method in full: what each script measures, how, and how far to trust each number. The results file this page renders is in the repository.