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 | ||||
|---|---|---|---|---|---|---|---|---|---|---|
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 | |||
@sapphire/shapeshift (run) | Code snippet | 4.0.0 | 629.44K | None | All errors | 262 μs | 1.83x | |||
@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 | 1.85x | ||
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.59x | ||
runtypes | Code snippet | 7.0.4 | 279.42K | None | Abort early | 182 μs | 2.64x | |||
arktype | Code snippet | 2.2.0 | 885.45K | JIT | All errors | 91 μs | 5.29x | |||
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 | 5.46x | ||
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 | 5.65x | ||
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 | 5.83x | ||
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 | 6x | ||
zod (jitless) | Code snippet | 4.3.6 | 151.14M | None | All errors | 78 μs | 6.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 | 6.29x | ||
superstruct | Code snippet | 2.0.2 | 4.02M | None | All errors | 75 μs | 6.44x | |||
superstruct | Code snippet | 2.0.2 | 4.02M | None | All errors | 74 μs | 6.49x | |||
decoders | Code snippet | 2.9.3 | 38.55K | None | All errors | 74 μs | 6.53x | |||
zod | Code snippet | 4.3.6 | 151.14M | JIT | All errors | 73 μs | 6.55x | |||
zod/mini (jitless) | Code snippet | 4.3.6 | 151.14M | None | All errors | 64 μs | 7.53x | |||
zod/mini | Code snippet | 4.3.6 | 151.14M | JIT | All errors | 64 μs | 7.54x | |||
joi | Code snippet | 18.1.2 | 18.74M | None | All errors | 55 μs | 8.73x | |||
zod/v3 | Code snippet | 4.3.6 | 151.14M | None | All errors | 37 μs | 12.89x | |||
effect | Code snippet(Commented code is not benchmarked) | 3.21.0 | 9.44M | None | All errors | 31 μs | 15.58x | |||
@railway-ts/pipelines | Code snippet | 0.1.27 | 34 | None | All errors | 29 μs | 16.49x | |||
valibot (abortPipeEarly only) | Code snippet | 1.3.1 | 7.93M | None | Abort early | 28 μs | 17.39x | |||
valibot | Code snippet | 1.3.1 | 7.93M | None | All errors | 27 μs | 17.84x | |||
effect@beta | Code snippet(Commented code is not benchmarked) | 4.0.0-beta.46 | 9.44M | None | All errors | 22 μs | 22.21x | |||
superstruct (schema.validate) | Code snippet | 2.0.2 | 4.02M | None | Abort early | 10 μs | 47.35x | |||
superstruct | Code snippet | 2.0.2 | 4.02M | None | Abort early | 10 μs | 48.58x | |||
effect | Code snippet(Commented code is not benchmarked) | 3.21.0 | 9.44M | None | Abort early | 9 μs | 50.85x | |||
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 | 61.05x | ||
sury (safe) | Code snippet | 11.0.0-alpha.4 | 146.04K | JIT | All errors | 8 μs | 61.31x | |||
sury (compile + safe) | Code snippet(Commented code is not benchmarked) | 11.0.0-alpha.4 | 146.04K | JIT | All errors | 8 μs | 62.41x | |||
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 | 65.2x | ||
typia (validate) | Code snippet | 12.0.2 | 259.06K | Precompiled | All errors | 6 μs | 74.56x | |||
io-ts | Code snippet | 2.2.22 | 2.92M | None | All errors | 6 μs | 78.24x | |||
typia (createValidate) | Code snippet(Commented code is not benchmarked) | 12.0.2 | 259.06K | Precompiled | All errors | 6 μs | 78.68x | |||
joi | Code snippet | 18.1.2 | 18.74M | None | Abort early | 4 μs | 118.79x | |||
effect@beta | Code snippet(Commented code is not benchmarked) | 4.0.0-beta.46 | 9.44M | None | Abort early | 1 μs | 408.74x | |||
valibot | Code snippet | 1.3.1 | 7.93M | None | Abort early | 701 ns | 684.86x | |||
ata-validator | Code snippet | 0.8.0 | 728 | JIT | All errors | 682 ns | 703.81x | |||
@railway-ts/pipelines | Code snippet | 0.1.27 | 34 | None | Abort early | 643 ns | 746.27x | |||