Benchmark

Two scripts, one rule: measure schema.parse(input) on a fixed input, report ms and ops/s, nothing else.

Scripts

ScriptCommandWhat it does
benchmark/run.mjsnpm run benchParses 6 valdix schemas 50,000 times each. No dependency.
benchmark/compare.mjsnpm run bench:compareParses 5 equivalent valdix/zod pairs 100,000 times each. Requires zod@3.

Method

  1. Build first: npm run build. Both scripts import ../dist/index.js.
  2. Warmup: 1,000 parses per schema. V8 compiles the hot path so the loop measures steady state, not first-call cost.
  3. Time with performance.now() around a tight for loop. No async, no I/O inside.
  4. ops/s is iterations divided by elapsed seconds.

Measured results

Machine: AMD Ryzen 5 6600H (12 threads), 16 GB RAM, Arch Linux kernel 6.18.38-1-lts, Node v24.15.0 x64. Valdix 0.6.0, averaged across 5 runs on 2026-09-14:

caseavg ops/srun 1run 2run 3run 4run 5
string4.43M3.64M4.31M3.45M6.33M4.44M
email3.66M3.16M4.75M2.88M4.36M3.14M
minLen5.52M6.47M5.04M4.85M5.56M5.70M
number5.12M5.29M4.72M4.63M6.86M4.10M
obj561k512k703k509k564k519k
array2.84M2.95M3.04M2.17M2.98M3.04M

Per-run spread is wide (CPU frequency scaling on a laptop). Use the average, not a single run.

Against Zod

Same machine, Zod 3.25.76, 100,000 iterations per case, averaged across 5 runs. Valdix leads on email, numbers, objects, and arrays; plain strings are tied. Throughput still flips by machine and Zod version, so re-run on your hardware before repeating a speed claim.

caseValdix avgZod avgresult here
string6.06M6.21Mabout tied
email4.33M3.16MValdix about 1.4x faster
number7.75M5.48MValdix about 1.4x faster
object1.28M1.04MValdix about 1.2x faster
array4.27M1.48MValdix about 2.9x faster

Reproduce

cd /tmp && mkdir bench && cd bench && npm init -y && npm i zod@3
ln -s /path/to/valdix/dist ./valdix
for i in 1 2 3 4 5; do node /path/to/valdix/benchmark/compare.mjs; done

Average the 5 runs per case on an idle machine. Record CPU, Node version, valdix version, zod version, iteration count, and run count. Numbers from different machines are not comparable.

Limits

These scripts do not measure validation failure paths, async refinements, bundle size, memory use, or type inference quality. A 10-20% gap is noise. A 2x gap is real.