Many libraries implement the Standard Schema interface, which allows many other libraries to accept them without needing to specialise for each library.
import { 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 | Downloads (/wk) | Optimizations | Error type | Mean | Compare | ||||
|---|---|---|---|---|---|---|---|---|---|---|
joi | Code snippet | 18.0.2 | 18M | None | All errors | 4 μs | ||||
effect | Code snippet(Commented code is not benchmarked) | 3.19.19 | 8.3M | None | Abort early | 5 μs | 1.09x | |||
sury | Code snippet | 11.0.0-alpha.4 | 148K | JIT | All errors | 8 μs | 1.82x | |||
typia | Code snippet(Commented code is not benchmarked) | 11.0.3 | 244K | Precompiled | All errors | 11 μs | 2.44x | |||
valibot | Code snippet | 1.2.0 | 6.6M | None | All errors | 29 μs | 6.48x | |||
effect@beta | Code snippet(Commented code is not benchmarked) | 4.0.0-beta.5 | 8.3M | None | Abort early | 30 μs | 6.84x | |||
effect@beta | Code snippet(Commented code is not benchmarked) | 4.0.0-beta.5 | 8.3M | None | All errors | 30 μs | 6.88x | |||
@railway-ts/pipelines | Code snippet | 0.1.27 | 155 | None | All errors | 31 μs | 6.98x | |||
zod/mini | Code snippet | 4.3.6 | 106M | JIT | All errors | 71 μs | 16.19x | |||
effect | Code snippet(Commented code is not benchmarked) | 3.19.19 | 8.3M | None | All errors | 73 μs | 16.65x | |||
zod | Code snippet | 4.3.6 | 106M | JIT | All errors | 76 μs | 17.18x | |||
arktype | Code snippet | 2.1.29 | 972K | JIT | All errors | 98 μs | 22.19x | |||
yup | Code snippet | 1.7.1 | 10M | None | All errors | 552 μs | 125.16x | |||