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 | |||
|---|---|---|---|---|---|---|---|---|---|
@paseri/paseri | Code snippet | 1.9.7 | 418 | None | All errors | 6 μs | |||
@paseri/compiler | Code snippet | 0.7.7 | 395 | Precompiled | All errors | 3 μs | 1.71x | ||
@mionjs/run-types | Code snippet(Setup code is not benchmarked) | 0.20.0 | n/a | Precompiled | All errors | 2 μs | 3.46x | ||
@railway-ts/pipelines | Code snippet | 0.1.29 | n/a | None | All errors | 19 μs | 3.24x | ||
@remix-run/data-schema | Code snippet | 1.0.1 | n/a | None | All errors | 11 μs | 1.92x | ||
arktype | Code snippet | 2.2.10 | n/a | JIT | All errors | 87 μs | 14.68x | ||
ata-validator | Code snippet | 1.65.0 | n/a | JIT | All errors | 3 μs | 1.86x | ||
decoders | Code snippet | 2.13.0 | n/a | None | All errors | 112 μs | 18.94x | ||
effect | Code snippet(Setup code is not benchmarked) | 4.1.5 | n/a | None | Abort early | 2 μs | 2.58x | ||
effect | Code snippet(Setup code is not benchmarked) | 4.1.5 | n/a | None | All errors | 20 μs | 3.45x | ||
joi | Code snippet | 18.3.2 | n/a | None | All errors | 4 μs | 1.46x | ||
sury | Code snippet | 11.1.0 | n/a | JIT | All errors | 4 μs | 1.45x | ||
typia | Code snippet(Setup code is not benchmarked) | 15.4.1 | n/a | Precompiled | All errors | 16 μs | 2.71x | ||
valibot | Code snippet | 1.5.0 | n/a | None | All errors | 10 μs | 1.75x | ||
yup | Code snippet | 1.7.1 | n/a | None | All errors | 345 μs | 58.47x | ||
zod | Code snippet | 4.6.7 | n/a | JIT | All errors | 14 μs | 2.35x | ||
zod (compile) | Code snippet(Setup code is not benchmarked) | 4.6.7 | n/a | JIT | All errors | 14 μs | 2.38x | ||
zod-compiler | Code snippet | 2.0.12 | n/a | Precompiled | All errors | 5 μs | 1.1x | ||
zod-compiler (bag + mini) | Code snippet | 2.0.12 | n/a | Precompiled | All errors | 5 μs | 1.09x | ||
zod-compiler (bag) | Code snippet | 2.0.12 | n/a | Precompiled | All errors | 5 μs | 1.08x | ||
zod-compiler (compact + mini) | Code snippet | 2.0.12 | n/a | Precompiled | All errors | 27 μs | 4.54x | ||
zod-compiler (compact) | Code snippet | 2.0.12 | n/a | Precompiled | All errors | 20 μs | 3.46x | ||
zod-compiler (mini) | Code snippet | 2.0.12 | n/a | Precompiled | All errors | 5 μs | 1.1x | ||
zod/mini | Code snippet | 4.6.7 | n/a | JIT | All errors | 18 μs | 3.1x | ||
zod/mini (compile) | Code snippet(Setup code is not benchmarked) | 4.6.7 | n/a | JIT | All errors | 18 μs | 3.11x | ||
zod/v3 | Code snippet | 4.6.7 | n/a | None | All errors | 23 μs | 3.98x | ||