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.29 | 143 | None | Abort early | 17 μs | ||||
@railway-ts/pipelines | Code snippet | 0.1.29 | 143 | None | All errors | 18 μs | 1.03x | |||
@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 | 25 μs | 1.42x | ||
@sapphire/shapeshift (run) | Code snippet | 4.0.0 | 846.87K | None | All errors | 25 μs | 1.42x | |||
arktype | Code snippet | 2.2.0 | 896.39K | JIT | All errors | 6 μs | 2.82x | |||
ata-validator | Code snippet | 0.13.2 | 750 | JIT | All errors | 177 ns | 98.37x | |||
decoders | Code snippet | 2.9.3 | 58.56K | None | All errors | 16 μs | 1.1x | |||
effect | Code snippet(Commented code is not benchmarked) | 3.21.2 | 13.85M | None | Abort early | 19 μs | 1.08x | |||
effect | Code snippet(Commented code is not benchmarked) | 3.21.2 | 13.85M | None | All errors | 20 μs | 1.16x | |||
effect@beta | Code snippet(Commented code is not benchmarked) | 4.0.0-beta.65 | 13.85M | None | Abort early | 17 μs | 1.04x | |||
effect@beta | Code snippet(Commented code is not benchmarked) | 4.0.0-beta.65 | 13.85M | None | All errors | 17 μs | 1.03x | |||
io-ts | Code snippet | 2.2.22 | 3.37M | None | All errors | 6 μs | 2.84x | |||
joi | Code snippet | 18.2.1 | 20.07M | None | Abort early | 38 μs | 2.19x | |||
joi | Code snippet | 18.2.1 | 20.07M | None | All errors | 38 μs | 2.2x | |||
runtypes | Code snippet | 7.0.4 | 310.48K | None | Abort early | 68 μs | 3.9x | |||
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 | 68 μs | 3.91x | ||
superstruct | Code snippet | 2.0.2 | 4.68M | None | All errors | 52 μs | 2.99x | |||
superstruct | Code snippet | 2.0.2 | 4.68M | None | Abort early | 52 μs | 3x | |||
superstruct | Code snippet | 2.0.2 | 4.68M | None | All errors | 52 μs | 3x | |||
superstruct (schema.validate) | Code snippet | 2.0.2 | 4.68M | None | Abort early | 52 μs | 2.99x | |||
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 | 2 μs | 7.53x | ||
sury (compile + safe) | Code snippet(Commented code is not benchmarked) | 11.0.0-alpha.4 | 194.21K | JIT | All errors | 2 μs | 7.82x | |||
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 | 2 μs | 7.83x | ||
sury (safe) | Code snippet | 11.0.0-alpha.4 | 194.21K | JIT | All errors | 2 μs | 7.52x | |||
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 | 5.41x | ||
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 | 3 μs | 6.02x | ||
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 | 3 μs | 6.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.38 | 1.75M | JIT | All errors | 80 μs | 4.61x | ||
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 | 3 μs | 5.84x | ||
typia (createValidate) | Code snippet(Commented code is not benchmarked) | 12.1.1 | 259.87K | Precompiled | All errors | 1 μs | 15.82x | |||
typia (validate) | Code snippet | 12.1.1 | 259.87K | Precompiled | All errors | 1 μs | 14.86x | |||
valibot | Code snippet | 1.4.0 | 10.19M | None | Abort early | 12 μs | 1.48x | |||
valibot | Code snippet | 1.4.0 | 10.19M | None | All errors | 12 μs | 1.4x | |||
valibot (abortPipeEarly only) | Code snippet | 1.4.0 | 10.19M | None | Abort early | 12 μs | 1.49x | |||
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 | 132 μs | 7.56x | ||
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 | 132 μs | 7.58x | ||
zod | Code snippet | 4.4.3 | 165.11M | JIT | All errors | 10 μs | 1.8x | |||
zod (jitless) | Code snippet | 4.4.3 | 165.11M | None | All errors | 16 μs | 1.11x | |||
zod/mini | Code snippet | 4.4.3 | 165.11M | JIT | All errors | 15 μs | 1.13x | |||
zod/mini (jitless) | Code snippet | 4.4.3 | 165.11M | None | All errors | 15 μs | 1.13x | |||
zod/v3 | Code snippet | 4.4.3 | 165.11M | None | All errors | 17 μs | 1x | |||