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 });
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.
| Library | Version | /wk | Optimizations | Error type | Mean | Compare | |||
|---|---|---|---|---|---|---|---|---|---|
joi | Code snippet | 18.2.3 | 20.46M | None | All errors | 4 μs | |||
effect | Code snippet(Commented code is not benchmarked) | 3.22.0 | 24.3M | None | Abort early | 5 μs | 1.08x | ||
@paseri/paseri | Code snippet | 1.9.7 | 172 | None | All errors | 6 μs | 1.28x | ||
valibot | Code snippet | 1.4.2 | 14.88M | None | All errors | 29 μs | 6.63x | ||
@railway-ts/pipelines | Code snippet | 0.1.29 | 123 | None | All errors | 31 μs | 7.09x | ||
effect@beta | Code snippet(Commented code is not benchmarked) | 4.0.0-beta.101 | 24.3M | None | Abort early | 32 μs | 7.16x | ||
effect@beta | Code snippet(Commented code is not benchmarked) | 4.0.0-beta.101 | 24.3M | None | All errors | 32 μs | 7.2x | ||
zod/v3 | Code snippet | 4.4.3 | 223.55M | None | All errors | 37 μs | 8.32x | ||
decoders | Code snippet | 2.9.3 | 24.27K | None | All errors | 68 μs | 15.33x | ||
effect | Code snippet(Commented code is not benchmarked) | 3.22.0 | 24.3M | None | All errors | 69 μs | 15.62x | ||
yup | Code snippet | 1.7.1 | 10.52M | None | All errors | 634 μs | 143.14x | ||