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 | ||||
|---|---|---|---|---|---|---|---|---|---|---|
zod/v3 | Code snippet | 4.4.3 | 165.11M | None | All errors | 36 μs | ||||
zod/mini (jitless) | Code snippet | 4.4.3 | 165.11M | None | All errors | 58 μs | 1.6x | |||
zod/mini | Code snippet | 4.4.3 | 165.11M | JIT | All errors | 58 μs | 1.62x | |||
zod (jitless) | Code snippet | 4.4.3 | 165.11M | None | All errors | 69 μs | 1.9x | |||
zod | Code snippet | 4.4.3 | 165.11M | JIT | All errors | 63 μs | 1.75x | |||
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 | 11.07M | None | Abort early | 83 μs | 2.3x | ||
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 | 11.07M | None | All errors | 484 μs | 13.44x | ||
valibot (abortPipeEarly only) | Code snippet | 1.4.0 | 10.19M | None | Abort early | 27 μs | 1.35x | |||
valibot | Code snippet | 1.4.0 | 10.19M | None | Abort early | 715 ns | 50.32x | |||
valibot | Code snippet | 1.4.0 | 10.19M | None | All errors | 27 μs | 1.34x | |||
typia (validate) | Code snippet | 12.1.1 | 259.87K | Precompiled | All errors | 6 μs | 5.65x | |||
typia (createValidate) | Code snippet(Commented code is not benchmarked) | 12.1.1 | 259.87K | Precompiled | All errors | 6 μs | 5.95x | |||
typebox (script 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.38 | 1.75M | JIT | All errors | 90 μs | 2.49x | ||
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.38 | 1.75M | JIT | All errors | 85 μs | 2.36x | ||
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.38 | 1.75M | JIT | All errors | 80 μs | 2.22x | ||
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.38 | 1.75M | JIT | All errors | 87 μs | 2.43x | ||
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.38 | 1.75M | JIT | All errors | 94 μs | 2.61x | ||
sury (safe) | Code snippet | 11.0.0-alpha.4 | 194.21K | JIT | All errors | 8 μs | 4.56x | |||
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 | 194.21K | JIT | All errors | 8 μs | 4.76x | ||
sury (compile + safe) | Code snippet(Commented code is not benchmarked) | 11.0.0-alpha.4 | 194.21K | JIT | All errors | 8 μs | 4.74x | |||
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 | 194.21K | JIT | All errors | 8 μs | 4.58x | ||
superstruct (schema.validate) | Code snippet | 2.0.2 | 4.68M | None | Abort early | 10 μs | 3.59x | |||
superstruct | Code snippet | 2.0.2 | 4.68M | None | Abort early | 10 μs | 3.68x | |||
superstruct | Code snippet | 2.0.2 | 4.68M | None | All errors | 74 μs | 2.04x | |||
superstruct | Code snippet | 2.0.2 | 4.68M | None | All errors | 74 μs | 2.05x | |||
runtypes | Code snippet | 7.0.4 | 310.48K | None | Abort early | 170 μs | 4.73x | |||
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 | 310.48K | None | Abort early | 182 μs | 5.05x | ||
joi | Code snippet | 18.2.1 | 20.07M | None | Abort early | 4 μs | 8.93x | |||
joi | Code snippet | 18.2.1 | 20.07M | None | All errors | 55 μs | 1.52x | |||
io-ts | Code snippet | 2.2.22 | 3.37M | None | All errors | 6 μs | 6.02x | |||
effect@beta | Code snippet(Commented code is not benchmarked) | 4.0.0-beta.65 | 13.85M | None | Abort early | 1 μs | 29.92x | |||
effect@beta | Code snippet(Commented code is not benchmarked) | 4.0.0-beta.65 | 13.85M | None | All errors | 20 μs | 1.77x | |||
effect | Code snippet(Commented code is not benchmarked) | 3.21.2 | 13.85M | None | Abort early | 10 μs | 3.77x | |||
effect | Code snippet(Commented code is not benchmarked) | 3.21.2 | 13.85M | None | All errors | 30 μs | 1.19x | |||
decoders | Code snippet | 2.9.3 | 58.56K | None | All errors | 65 μs | 1.82x | |||
ata-validator | Code snippet | 0.13.2 | 750 | JIT | All errors | 738 ns | 48.75x | |||
arktype | Code snippet | 2.2.0 | 896.39K | JIT | All errors | 91 μs | 2.52x | |||
@sapphire/shapeshift (run) | Code snippet | 4.0.0 | 846.87K | None | All errors | 262 μs | 7.28x | |||
@sapphire/shapeshift | 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. | 4.0.0 | 846.87K | None | All errors | 268 μs | 7.44x | ||
@railway-ts/pipelines | Code snippet | 0.1.29 | 143 | None | Abort early | 634 ns | 56.78x | |||
@railway-ts/pipelines | Code snippet | 0.1.29 | 143 | None | All errors | 29 μs | 1.26x | |||