fuz_schema

a performance-focused
schema library for JS

fuz_schema takes Valibot's approach, with a tree-shakeable function per schema and pipe for refinement, and pushes it further on bundle size, speed, and memory, with simpler internals. It's published as @fuzdev/fuz_schema and is pre-1.0; feedback is welcome in the issues and discussions.

For now this site has only benchmarks and the generated API reference docs. For usage docs, see the README.

about · docs · benchmarks · source

Measured

Against Valibot, Zod, Zod compiled, Zod Mini, TypeBox, Valita, Sury, from one run on laptop1 on 2026-11-23. fuz_schema compiled is fuz_schema in another mode, and not another library. Each heading links to the rows behind its figure, and the benchmarks page says how each was measured.

Bundle size
fuz_schema 3.03 kB 1.00×
Valibot 3.56 kB 1.18×
Valita 5.45 kB 1.80×
fuz_schema compiled 8.56 kB 2.82×
Zod Mini 9.21 kB 3.04×
Sury 23.3 kB 7.70×
Zod 26.0 kB 8.58×
Zod compiled 33.1 kB 10.9×
TypeBox 39.5 kB 13.0×

lower is better — bytes of every scenario in one bundle, minified and gzipped

  • 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.
Parsing valid input
fuz_schema compiled 74.1 ns ≈1.00×
Sury 78.7 ns ≈1.06×
TypeBox 102 ns 1.38×
Zod compiled 155 ns 2.09×
fuz_schema 322 ns 4.34×
Valita 357 ns 4.82×
Zod 560 ns 7.56×
Valibot 883 ns 11.9×
Zod Mini 1.15 µs 15.5×

lower is better — time per call, 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 uncompiled. A ratio marked ≈ is of two figures whose readings overlap: not a difference, and not ranked

  • 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.
  • 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.
  • Zod Mini: Its objects never compile: zod/mini has no generated parser.
  • 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: 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.
Rejecting invalid input
TypeBox 77.1 ns 1.00×
Valita 368 ns 4.77×
fuz_schema compiled 404 ns 5.23×
fuz_schema 417 ns 5.41×
Sury 517 ns 6.70×
Valibot 1.62 µs 21.0×
Zod compiled 2.54 µs 32.9×
Zod 2.59 µs 33.6×
Zod Mini 3.72 µs 48.2×

lower is better — time per call, 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 uncompiled. Level with each other, their readings overlapping, in whatever order they are drawn: fuz_schema compiled and fuz_schema; Zod compiled and Zod

  • fuz_schema compiled: 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.
  • 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 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.
  • TypeBox: Every row is a Check of its compiled validator, which stops at the first failure and builds no issues and no output.
  • 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.
Answering only whether it matches
fuz_schema compiled 55.5 ns 1.00×
Sury 58.1 ns 1.05×
TypeBox 99.3 ns 1.79×
Zod compiled 116 ns 2.08×
fuz_schema 308 ns 5.55×
Valita 360 ns 6.49×
Zod 488 ns 8.78×
Valibot 861 ns 15.5×
Zod Mini 1.17 µs 21.1×

lower is better — time per call, 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 uncompiled

  • fuz_schema compiled: 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: 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.
  • Zod Mini: 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: 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.
Cold start
fuz_schema 0.97 ms 1.00×
Valibot 1.33 ms 1.37×
Valita 2.24 ms 2.30×
fuz_schema compiled 3.99 ms 4.11×
Zod Mini 4.07 ms 4.20×
Sury 10.8 ms 11.1×
TypeBox 15.4 ms 15.9×
Zod 15.9 ms 16.4×
Zod compiled 17.0 ms 17.5×

lower is better — work inside a fresh process to import a bundled entry, build a schema, and parse once, geometric mean over 3 of 3 rows. Level with each other, their readings overlapping, in whatever order they are drawn: fuz_schema compiled and Zod Mini; TypeBox and Zod; Zod and Zod compiled

  • 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.
Memory held
fuz_schema 50.6 kB 1.00×
Valibot 74.7 kB 1.48×
Valita 156 kB 3.09×
fuz_schema compiled 191 kB 3.77×
Zod Mini 259 kB 5.12×
Sury 487 kB 9.63×
Zod 903 kB 17.8×
Zod compiled 975 kB 19.3×
TypeBox 1.25 MB 24.7×

lower is better — what a process holds after one schema is built and has parsed once, over a bare one, geometric mean over 2 of 2 rows

  • 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 per further schema
fuz_schema 2.63 kB 1.00×
fuz_schema compiled 6.48 kB 2.46×
Valita 6.63 kB 2.52×
Valibot 7.40 kB 2.81×
Zod Mini 16.5 kB 6.28×
TypeBox 27.9 kB 10.6×
Zod compiled 37.9 kB 14.4×
Zod 41.9 kB 15.9×
Sury 54.5 kB 20.7×

lower is better — what each further schema adds to what a process holds, read between processes holding 50 schemas and 250, geometric mean over 2 of 2 rows

  • 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.