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 | 182.46M | None | All errors | 40 μs | ||||
zod/mini (jitless) | Code snippet | 4.4.3 | 182.46M | None | All errors | 64 μs | 1.61x | |||
zod/mini | Code snippet | 4.4.3 | 182.46M | JIT | All errors | 64 μs | 1.62x | |||
zod (jitless) | Code snippet | 4.4.3 | 182.46M | None | All errors | 82 μs | 2.06x | |||
zod | Code snippet | 4.4.3 | 182.46M | JIT | All errors | 77 μs | 1.92x | |||
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.8M | None | Abort early | 96 μs | 2.4x | ||
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.8M | None | All errors | 537 μs | 13.45x | ||
valibot (abortPipeEarly only) | Code snippet | 1.4.0 | 11.35M | None | Abort early | 30 μs | 1.35x | |||
valibot | Code snippet | 1.4.0 | 11.35M | None | Abort early | 778 ns | 51.29x | |||
valibot | Code snippet | 1.4.0 | 11.35M | None | All errors | 30 μs | 1.35x | |||
typia (validate) | Code snippet | 12.1.1 | 308.56K | Precompiled | All errors | 7 μs | 5.9x | |||
typia (createValidate) | Code snippet(Commented code is not benchmarked) | 12.1.1 | 308.56K | Precompiled | All errors | 7 μs | 6.09x | |||
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 | 2.25M | JIT | All errors | 94 μs | 2.35x | ||
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 | 2.25M | JIT | All errors | 88 μs | 2.21x | ||
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 | 2.25M | JIT | All errors | 84 μs | 2.1x | ||
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 | 2.25M | JIT | All errors | 92 μs | 2.3x | ||
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 | 2.25M | JIT | All errors | 99 μs | 2.48x | ||
sury (safe) | Code snippet | 11.0.0-alpha.5 | 230.14K | JIT | All errors | 8 μs | 5.15x | |||
sury | 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.5 | 230.14K | JIT | All errors | 7 μs | 5.52x | ||
superstruct (schema.validate) | Code snippet | 2.0.2 | 5.17M | None | Abort early | 10 μs | 3.91x | |||
superstruct | Code snippet | 2.0.2 | 5.17M | None | Abort early | 10 μs | 3.98x | |||
superstruct | Code snippet | 2.0.2 | 5.17M | None | All errors | 79 μs | 1.98x | |||
superstruct | Code snippet | 2.0.2 | 5.17M | None | All errors | 79 μs | 1.98x | |||
runtypes | Code snippet | 7.0.4 | 298.1K | None | Abort early | 189 μs | 4.74x | |||
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 | 298.1K | None | Abort early | 205 μs | 5.14x | ||
joi | Code snippet | 18.2.1 | 21.05M | None | Abort early | 4 μs | 9.87x | |||
joi | Code snippet | 18.2.1 | 21.05M | None | All errors | 62 μs | 1.55x | |||
io-ts | Code snippet | 2.2.22 | 3.22M | None | All errors | 6 μs | 6.63x | |||
effect@beta | Code snippet(Commented code is not benchmarked) | 4.0.0-beta.70 | 15.22M | None | Abort early | 1 μs | 35.06x | |||
effect@beta | Code snippet(Commented code is not benchmarked) | 4.0.0-beta.70 | 15.22M | None | All errors | 20 μs | 2.02x | |||
effect | Code snippet(Commented code is not benchmarked) | 3.21.2 | 15.22M | None | Abort early | 9 μs | 4.3x | |||
effect | Code snippet(Commented code is not benchmarked) | 3.21.2 | 15.22M | None | All errors | 31 μs | 1.28x | |||
decoders | Code snippet | 2.9.3 | 53.24K | None | All errors | 66 μs | 1.65x | |||
ata-validator | Code snippet | 0.15.0 | 1.22K | JIT | All errors | 34 μs | 1.17x | |||
arktype | Code snippet | 2.2.0 | 976.91K | JIT | All errors | 98 μs | 2.46x | |||
@sapphire/shapeshift (run) | Code snippet | 4.0.0 | 901.24K | None | All errors | 275 μs | 6.9x | |||
@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 | 901.24K | None | All errors | 272 μs | 6.81x | ||
@railway-ts/pipelines | Code snippet | 0.1.29 | 52 | None | Abort early | 652 ns | 61.26x | |||
@railway-ts/pipelines | Code snippet | 0.1.29 | 52 | None | All errors | 30 μs | 1.31x | |||