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 | |||
|---|---|---|---|---|---|---|---|---|---|
effect | Code snippet(Setup code is not benchmarked) | 4.1.2 | n/a | None | Abort early | 1 μs | |||
joi | Code snippet | 18.3.2 | n/a | None | All errors | 3 μs | 1.84x | ||
@paseri/paseri | Code snippet | 1.9.7 | 520 | None | All errors | 4 μs | 2.7x | ||
valibot | Code snippet | 1.5.0 | n/a | None | All errors | 6 μs | 4.62x | ||
@remix-run/data-schema | Code snippet | 1.0.0 | n/a | None | All errors | 7 μs | 5.22x | ||
@railway-ts/pipelines | Code snippet | 0.1.29 | n/a | None | All errors | 13 μs | 9.06x | ||
effect | Code snippet(Setup code is not benchmarked) | 4.1.2 | n/a | None | All errors | 14 μs | 9.8x | ||
zod/v3 | Code snippet | 4.6.7 | n/a | None | All errors | 15 μs | 10.92x | ||
decoders | Code snippet | 2.13.0 | n/a | None | All errors | 76 μs | 54x | ||
yup | Code snippet | 1.7.1 | n/a | None | All errors | 208 μs | 148.06x | ||