Many libraries implement the Standard Schema interface, which allows many other libraries to accept them without needing to specialise for each library.
Copy to clipboardimport { personSchema } from "./schemas"; const person = await upfetch(url, { schema: personSchema, });
Copy to clipboardimport { personSchema } from "./schemas"; const person = await upfetch(url, { schema: personSchema });
We benchmark the time taken to parse using a standard schema.
Info
Some libraries require an adapter before they can be used as a standard schema. The time to convert the schema is not measured, only the time to parse using it.
Optimizations
Abort early
| Library | Version | /wk | Optimizations | Error type | Mean | Compare | |||
|---|---|---|---|---|---|---|---|---|---|
@mionjs/run-types | Code snippet(Setup code is not benchmarked) | 0.20.0 | 99 | Precompiled | All errors | 962 ns | |||
effect | Code snippet(Setup code is not benchmarked) | 4.1.5 | 67.63M | None | Abort early | 1 μs | 1.32x | ||
@paseri/compiler | Code snippet | 0.7.7 | 109 | Precompiled | All errors | 2 μs | 2.15x | ||
ata-validator | Code snippet | 1.65.0 | 51.07K | JIT | All errors | 2 μs | 2.18x | ||
joi | Code snippet | 18.3.2 | 33.59M | None | All errors | 3 μs | 2.84x | ||
sury | Code snippet | 11.1.0 | 609.62K | JIT | All errors | 3 μs | 2.88x | ||
zod-compiler (bag + mini) | Code snippet | 2.0.14 | 186K | Precompiled | All errors | 4 μs | 3.84x | ||
zod-compiler (mini) | Code snippet | 2.0.14 | 186K | Precompiled | All errors | 4 μs | 3.87x | ||
zod-compiler | Code snippet | 2.0.14 | 186K | Precompiled | All errors | 4 μs | 3.89x | ||
zod-compiler (bag) | Code snippet | 2.0.14 | 186K | Precompiled | All errors | 4 μs | 3.9x | ||
@paseri/paseri | Code snippet | 1.9.7 | 136 | None | All errors | 4 μs | 4.05x | ||
valibot | Code snippet | 1.5.0 | 35.07M | None | All errors | 7 μs | 7.23x | ||
@remix-run/data-schema | Code snippet | 1.0.1 | 77.58K | None | All errors | 8 μs | 8.5x | ||
zod | Code snippet | 4.6.7 | 462.8M | JIT | All errors | 9 μs | 9.86x | ||
zod (compile) | Code snippet(Setup code is not benchmarked) | 4.6.7 | 462.8M | JIT | All errors | 10 μs | 9.99x | ||
typia | Code snippet(Setup code is not benchmarked) | 15.5.0 | 671.92K | Precompiled | All errors | 11 μs | 11.21x | ||
zod/mini | Code snippet | 4.6.7 | 462.8M | JIT | All errors | 13 μs | 13.49x | ||
zod/mini (compile) | Code snippet(Setup code is not benchmarked) | 4.6.7 | 462.8M | JIT | All errors | 13 μs | 13.51x | ||
effect | Code snippet(Setup code is not benchmarked) | 4.1.5 | 67.63M | None | All errors | 14 μs | 14.33x | ||
@railway-ts/pipelines | Code snippet | 0.6.0 | 2.06K | None | All errors | 14 μs | 14.41x | ||
zod-compiler (compact) | Code snippet | 2.0.14 | 186K | Precompiled | All errors | 14 μs | 14.8x | ||
zod/v3 | Code snippet | 4.6.7 | 462.8M | None | All errors | 16 μs | 16.65x | ||
zod-compiler (compact + mini) | Code snippet | 2.0.14 | 186K | Precompiled | All errors | 19 μs | 19.5x | ||
arktype | Code snippet | 2.2.10 | 3.19M | JIT | All errors | 62 μs | 64.68x | ||
decoders | Code snippet | 2.13.0 | 107.54K | None | All errors | 67 μs | 69.61x | ||
yup | Code snippet | 1.7.1 | 16.38M | None | All errors | 236 μs | 245.37x | ||