Parsing a value to match the schema. This is different to validation because it returns a new value.
Copy to clipboardimport * as v from "valibot"; import { personSchema } from "./schemas"; const person = v.parse(personSchema, data); // person is of type Person
| Library | Version | Downloads (/wk) | Optimizations | Error type | Mean | Compare | ||||
|---|---|---|---|---|---|---|---|---|---|---|
@railway-ts/pipelines | Code snippet | 0.1.27 | 31 | None | Abort early | 651 ns | ||||
valibot | Code snippet | 1.3.1 | 7.46M | None | Abort early | 729 ns | 1.12x | |||
effect@beta | Code snippet(Commented code is not benchmarked) | 4.0.0-beta.40 | 9.07M | None | Abort early | 1 μs | 1.64x | |||
ata-validator | Code snippet | 0.4.15 | 1.85K | JIT | All errors | 1 μs | 1.89x | |||
joi | Code snippet | 18.1.1 | 18.59M | None | Abort early | 4 μs | 5.99x | |||
io-ts | Code snippet | 2.2.22 | 2.81M | None | All errors | 6 μs | 8.92x | |||
typia (createValidate) | Code snippet(Commented code is not benchmarked) | 12.0.1 | 282.35K | Precompiled | All errors | 6 μs | 9.92x | |||
typia (validate) | Code snippet | 12.0.1 | 282.35K | Precompiled | All errors | 7 μs | 10.6x | |||
sury (compile) | Code snippet(Commented code is not benchmarked) | Throws on invalid dataThis library throws an error when parsing invalid data (and has no non-throwing equivalent), so the benchmark includes a try/catch. | 11.0.0-alpha.4 | 130.86K | JIT | All errors | 8 μs | 12.29x | ||
sury (compile + safe) | Code snippet(Commented code is not benchmarked) | 11.0.0-alpha.4 | 130.86K | JIT | All errors | 8 μs | 12.77x | |||
sury (safe) | Code snippet | 11.0.0-alpha.4 | 130.86K | JIT | All errors | 8 μs | 12.88x | |||
sury | Code snippet | Throws on invalid dataThis library throws an error when parsing invalid data (and has no non-throwing equivalent), so the benchmark includes a try/catch. | 11.0.0-alpha.4 | 130.86K | JIT | All errors | 8 μs | 12.91x | ||
effect | Code snippet(Commented code is not benchmarked) | 3.21.0 | 9.07M | None | Abort early | 10 μs | 14.78x | |||
superstruct | Code snippet | 2.0.2 | 4.11M | None | Abort early | 10 μs | 15.71x | |||
superstruct (schema.validate) | Code snippet | 2.0.2 | 4.11M | None | Abort early | 10 μs | 16.01x | |||
effect@beta | Code snippet(Commented code is not benchmarked) | 4.0.0-beta.40 | 9.07M | None | All errors | 21 μs | 31.78x | |||
valibot (abortPipeEarly only) | Code snippet | 1.3.1 | 7.46M | None | Abort early | 29 μs | 44.13x | |||
valibot | Code snippet | 1.3.1 | 7.46M | None | All errors | 29 μs | 44.6x | |||
@railway-ts/pipelines | Code snippet | 0.1.27 | 31 | None | All errors | 31 μs | 47.85x | |||
zod/v3 | Code snippet | 4.3.6 | 146.36M | None | All errors | 40 μs | 61.03x | |||
effect | Code snippet(Commented code is not benchmarked) | 3.21.0 | 9.07M | None | All errors | 42 μs | 63.84x | |||
joi | Code snippet | 18.1.1 | 18.59M | None | All errors | 61 μs | 94.25x | |||
decoders | Code snippet | 2.9.1 | 41.51K | None | All errors | 69 μs | 105.33x | |||
typebox (schema compile) | Code snippet(Commented code is not benchmarked) | Throws on invalid dataThis library throws an error when parsing invalid data (and has no non-throwing equivalent), so the benchmark includes a try/catch. | 1.1.6 | 227.83K | JIT | All errors | 71 μs | 108.78x | ||
zod/mini | Code snippet | 4.3.6 | 146.36M | JIT | All errors | 74 μs | 114.24x | |||
zod/mini (jitless) | Code snippet | 4.3.6 | 146.36M | None | All errors | 75 μs | 114.6x | |||
typebox (schema) | Code snippet | Throws on invalid dataThis library throws an error when parsing invalid data (and has no non-throwing equivalent), so the benchmark includes a try/catch. | 1.1.6 | 227.83K | JIT | All errors | 75 μs | 114.66x | ||
superstruct | Code snippet | 2.0.2 | 4.11M | None | All errors | 79 μs | 121.87x | |||
superstruct | Code snippet | 2.0.2 | 4.11M | None | All errors | 79 μs | 121.97x | |||
typebox (compile) | Code snippet(Commented code is not benchmarked) | Throws on invalid dataThis library throws an error when parsing invalid data (and has no non-throwing equivalent), so the benchmark includes a try/catch. | 1.1.6 | 227.83K | JIT | All errors | 80 μs | 122.93x | ||
typebox | Code snippet | Throws on invalid dataThis library throws an error when parsing invalid data (and has no non-throwing equivalent), so the benchmark includes a try/catch. | 1.1.6 | 227.83K | JIT | All errors | 85 μs | 131.39x | ||
zod | Code snippet | 4.3.6 | 146.36M | JIT | All errors | 88 μs | 135.66x | |||
zod (jitless) | Code snippet | 4.3.6 | 146.36M | None | All errors | 92 μs | 140.86x | |||
yup | Code snippet | Throws on invalid dataThis library throws an error when parsing invalid data (and has no non-throwing equivalent), so the benchmark includes a try/catch. | 1.7.1 | 10.53M | None | Abort early | 94 μs | 144.73x | ||
arktype | Code snippet | 2.2.0 | 911.72K | JIT | All errors | 97 μs | 148.47x | |||
runtypes | Code snippet | 7.0.4 | 264.28K | None | Abort early | 187 μs | 287.28x | |||
runtypes | Code snippet | Throws on invalid dataThis library throws an error when parsing invalid data (and has no non-throwing equivalent), so the benchmark includes a try/catch. | 7.0.4 | 264.28K | None | Abort early | 204 μs | 313.37x | ||
yup | Code snippet | Throws on invalid dataThis library throws an error when parsing invalid data (and has no non-throwing equivalent), so the benchmark includes a try/catch. | 1.7.1 | 10.53M | None | All errors | 540 μs | 829.98x | ||