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 | 17M | None | All errors | 5 μs | ||||
effect | Code snippet(Commented code is not benchmarked) | 3.19.19 | 8.1M | None | Abort early | 5 μs | 1.11x | |||
sury | Code snippet | 11.0.0-alpha.4 | 88K | JIT | All errors | 8 μs | 1.7x | |||
typia | Code snippet(Commented code is not benchmarked) | 11.0.3 | 233K | Precompiled | All errors | 10 μs | 2.3x | |||
valibot | Code snippet | 1.2.0 | 6.4M | None | All errors | 27 μs | 6x | |||
effect@beta | Code snippet(Commented code is not benchmarked) | 4.0.0-beta.5 | 8.1M | None | All errors | 29 μs | 6.25x | |||
effect@beta | Code snippet(Commented code is not benchmarked) | 4.0.0-beta.5 | 8.1M | None | Abort early | 29 μs | 6.25x | |||
@railway-ts/pipelines | Code snippet | 0.1.25 | 823 | None | All errors | 29 μs | 6.38x | |||
zod | Code snippet | 4.3.6 | 100M | JIT | All errors | 62 μs | 13.62x | |||
zod/mini | Code snippet | 4.3.6 | 100M | JIT | All errors | 62 μs | 13.69x | |||
effect | Code snippet(Commented code is not benchmarked) | 3.19.19 | 8.1M | None | All errors | 70 μs | 15.34x | |||
arktype | Code snippet | 2.1.29 | 739K | JIT | All errors | 90 μs | 19.72x | |||
yup | Code snippet | 1.7.1 | 9.8M | None | All errors | 490 μs | 107.29x | |||