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 | 105 | None | Abort early | 672 ns | ||||
valibot | Code snippet | 1.4.1 | 12.21M | None | Abort early | 764 ns | 1.14x | |||
effect@beta | Code snippet(Commented code is not benchmarked) | 4.0.0-beta.78 | 18.38M | None | Abort early | 1 μs | 1.62x | |||
joi | Code snippet | 18.2.1 | 22.51M | None | Abort early | 4 μs | 6.09x | |||
typia (createValidate) | Code snippet(Commented code is not benchmarked) | 12.1.1 | 321.84K | Precompiled | All errors | 7 μs | 9.86x | |||
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.7 | 190.79K | JIT | All errors | 7 μs | 9.89x | ||
typia (validate) | Code snippet | 12.1.1 | 321.84K | Precompiled | All errors | 7 μs | 10.01x | |||
io-ts | Code snippet | 2.2.22 | 3.76M | None | All errors | 7 μs | 10.25x | |||
sury (safe) | Code snippet | 11.0.0-alpha.7 | 190.79K | JIT | All errors | 7 μs | 10.62x | |||
effect | Code snippet(Commented code is not benchmarked) | 3.21.3 | 18.38M | None | Abort early | 9 μs | 13.86x | |||
superstruct | Code snippet | 2.0.2 | 5.29M | None | Abort early | 11 μs | 15.98x | |||
superstruct (schema.validate) | Code snippet | 2.0.2 | 5.29M | None | Abort early | 11 μs | 16.07x | |||
effect@beta | Code snippet(Commented code is not benchmarked) | 4.0.0-beta.78 | 18.38M | None | All errors | 20 μs | 30.26x | |||
valibot | Code snippet | 1.4.1 | 12.21M | None | All errors | 29 μs | 42.6x | |||
valibot (abortPipeEarly only) | Code snippet | 1.4.1 | 12.21M | None | Abort early | 29 μs | 42.71x | |||
@railway-ts/pipelines | Code snippet | 0.1.29 | 105 | None | All errors | 30 μs | 45.3x | |||
ata-validator | Code snippet | 0.21.0 | 499 | JIT | All errors | 32 μs | 47.25x | |||
effect | Code snippet(Commented code is not benchmarked) | 3.21.3 | 18.38M | None | All errors | 34 μs | 49.99x | |||
zod/v3 | Code snippet | 4.4.3 | 193.66M | None | All errors | 39 μs | 57.62x | |||
joi | Code snippet | 18.2.1 | 22.51M | None | All errors | 54 μs | 80.43x | |||
zod/mini (jitless) | Code snippet | 4.4.3 | 193.66M | None | All errors | 58 μs | 86.29x | |||
zod/mini | Code snippet | 4.4.3 | 193.66M | JIT | All errors | 58 μs | 86.97x | |||
zod | Code snippet | 4.4.3 | 193.66M | JIT | All errors | 68 μs | 100.43x | |||
zod (jitless) | Code snippet | 4.4.3 | 193.66M | None | All errors | 71 μs | 105.89x | |||
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.2.1 | 4.68M | JIT | All errors | 75 μs | 112.05x | ||
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.2.1 | 4.68M | JIT | All errors | 80 μs | 118.45x | ||
superstruct | Code snippet | 2.0.2 | 5.29M | None | All errors | 82 μs | 121.88x | |||
superstruct | Code snippet | 2.0.2 | 5.29M | None | All errors | 82 μs | 122.5x | |||
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.2.1 | 4.68M | JIT | All errors | 83 μs | 123.11x | ||
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.2.1 | 4.68M | JIT | All errors | 87 μs | 128.86x | ||
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 | 12.33M | None | Abort early | 88 μs | 130.58x | ||
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.2.1 | 4.68M | JIT | All errors | 89 μs | 132.21x | ||
decoders | Code snippet | 2.9.3 | 65.91K | None | All errors | 96 μs | 142.56x | |||
arktype | Code snippet | 2.2.0 | 1.15M | JIT | All errors | 105 μs | 155.46x | |||
runtypes | Code snippet | 7.0.4 | 320.04K | None | Abort early | 192 μs | 285.87x | |||
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 | 320.04K | None | Abort early | 206 μs | 306.02x | ||
@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 | 889.36K | None | All errors | 265 μs | 394.3x | ||
@sapphire/shapeshift (run) | Code snippet | 4.0.0 | 889.36K | None | All errors | 267 μs | 397.71x | |||
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 | 12.33M | None | All errors | 496 μs | 736.88x | ||