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 | Code snippet | 4.3.6 | 151.14M | JIT | All errors | 73 μs | ||||
zod (jitless) | Code snippet | 4.3.6 | 151.14M | None | All errors | 78 μs | 1.07x | |||
zod/mini | Code snippet | 4.3.6 | 151.14M | JIT | All errors | 64 μs | 1.15x | |||
zod/mini (jitless) | Code snippet | 4.3.6 | 151.14M | None | All errors | 64 μs | 1.15x | |||
zod/v3 | Code snippet | 4.3.6 | 151.14M | None | All errors | 37 μs | 1.97x | |||
joi | Code snippet | 18.1.2 | 18.74M | None | Abort early | 4 μs | 18.15x | |||
joi | Code snippet | 18.1.2 | 18.74M | None | All errors | 55 μs | 1.33x | |||
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.79M | None | Abort early | 85 μs | 1.16x | ||
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.79M | None | All errors | 480 μs | 6.55x | ||
effect | Code snippet(Commented code is not benchmarked) | 3.21.0 | 9.44M | None | Abort early | 9 μs | 7.77x | |||
effect | Code snippet(Commented code is not benchmarked) | 3.21.0 | 9.44M | None | All errors | 31 μs | 2.38x | |||
effect@beta | Code snippet(Commented code is not benchmarked) | 4.0.0-beta.46 | 9.44M | None | Abort early | 1 μs | 62.44x | |||
effect@beta | Code snippet(Commented code is not benchmarked) | 4.0.0-beta.46 | 9.44M | None | All errors | 22 μs | 3.39x | |||
valibot | Code snippet | 1.3.1 | 7.93M | None | Abort early | 701 ns | 104.63x | |||
valibot | Code snippet | 1.3.1 | 7.93M | None | All errors | 27 μs | 2.73x | |||
valibot (abortPipeEarly only) | Code snippet | 1.3.1 | 7.93M | None | Abort early | 28 μs | 2.66x | |||
superstruct | Code snippet | 2.0.2 | 4.02M | None | Abort early | 10 μs | 7.42x | |||
superstruct | Code snippet | 2.0.2 | 4.02M | None | All errors | 74 μs | 1.01x | |||
superstruct | Code snippet | 2.0.2 | 4.02M | None | All errors | 75 μs | 1.02x | |||
superstruct (schema.validate) | Code snippet | 2.0.2 | 4.02M | None | Abort early | 10 μs | 7.23x | |||
io-ts | Code snippet | 2.2.22 | 2.92M | None | All errors | 6 μs | 11.95x | |||
arktype | Code snippet | 2.2.0 | 885.45K | JIT | All errors | 91 μs | 1.24x | |||
@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 | 629.44K | None | All errors | 260 μs | 3.55x | ||
@sapphire/shapeshift (run) | Code snippet | 4.0.0 | 629.44K | None | All errors | 262 μs | 3.57x | |||
runtypes | Code snippet | 7.0.4 | 279.42K | None | Abort early | 182 μs | 2.48x | |||
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 | 279.42K | None | Abort early | 185 μs | 2.53x | ||
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.23 | 277.92K | JIT | All errors | 88 μs | 1.2x | ||
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.23 | 277.92K | JIT | All errors | 82 μs | 1.12x | ||
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.23 | 277.92K | JIT | All errors | 76 μs | 1.04x | ||
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.23 | 277.92K | JIT | All errors | 80 μs | 1.09x | ||
typia (createValidate) | Code snippet(Commented code is not benchmarked) | 12.0.2 | 259.06K | Precompiled | All errors | 6 μs | 12.02x | |||
typia (validate) | Code snippet | 12.0.2 | 259.06K | Precompiled | All errors | 6 μs | 11.39x | |||
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 | 146.04K | JIT | All errors | 8 μs | 9.33x | ||
sury (compile + safe) | Code snippet(Commented code is not benchmarked) | 11.0.0-alpha.4 | 146.04K | JIT | All errors | 8 μs | 9.53x | |||
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 | 146.04K | JIT | All errors | 7 μs | 9.96x | ||
sury (safe) | Code snippet | 11.0.0-alpha.4 | 146.04K | JIT | All errors | 8 μs | 9.37x | |||
decoders | Code snippet | 2.9.3 | 38.55K | None | All errors | 74 μs | 1x | |||
ata-validator | Code snippet | 0.8.0 | 728 | JIT | All errors | 682 ns | 107.52x | |||
@railway-ts/pipelines | Code snippet | 0.1.27 | 34 | None | Abort early | 643 ns | 114.01x | |||
@railway-ts/pipelines | Code snippet | 0.1.27 | 34 | None | All errors | 29 μs | 2.52x | |||