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 | 604 ns | ||||
valibot | Code snippet | 1.4.1 | 12.21M | None | Abort early | 679 ns | 1.12x | |||
effect@beta | Code snippet(Commented code is not benchmarked) | 4.0.0-beta.75 | 18.38M | None | Abort early | 1 μs | 1.93x | |||
joi | Code snippet | 18.2.1 | 22.51M | None | Abort early | 4 μs | 6.76x | |||
io-ts | Code snippet | 2.2.22 | 3.76M | None | All errors | 6 μs | 9.98x | |||
typia (createValidate) | Code snippet(Commented code is not benchmarked) | 12.1.1 | 321.84K | Precompiled | All errors | 6 μs | 10.36x | |||
typia (validate) | Code snippet | 12.1.1 | 321.84K | Precompiled | All errors | 7 μs | 10.87x | |||
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 | 11.39x | ||
sury (safe) | Code snippet | 11.0.0-alpha.7 | 190.79K | JIT | All errors | 7 μs | 12.13x | |||
effect | Code snippet(Commented code is not benchmarked) | 3.21.2 | 18.38M | None | Abort early | 9 μs | 15.08x | |||
superstruct | Code snippet | 2.0.2 | 5.29M | None | Abort early | 10 μs | 16.23x | |||
superstruct (schema.validate) | Code snippet | 2.0.2 | 5.29M | None | Abort early | 10 μs | 16.64x | |||
effect@beta | Code snippet(Commented code is not benchmarked) | 4.0.0-beta.75 | 18.38M | None | All errors | 20 μs | 33.43x | |||
valibot | Code snippet | 1.4.1 | 12.21M | None | All errors | 27 μs | 44.86x | |||
valibot (abortPipeEarly only) | Code snippet | 1.4.1 | 12.21M | None | Abort early | 27 μs | 45.04x | |||
@railway-ts/pipelines | Code snippet | 0.1.29 | 105 | None | All errors | 29 μs | 47.47x | |||
ata-validator | Code snippet | 0.21.0 | 499 | JIT | All errors | 31 μs | 50.86x | |||
zod/v3 | Code snippet | 4.4.3 | 193.66M | None | All errors | 37 μs | 60.56x | |||
effect | Code snippet(Commented code is not benchmarked) | 3.21.2 | 18.38M | None | All errors | 41 μs | 68.26x | |||
joi | Code snippet | 18.2.1 | 22.51M | None | All errors | 56 μs | 91.98x | |||
zod/mini (jitless) | Code snippet | 4.4.3 | 193.66M | None | All errors | 57 μs | 94.64x | |||
zod/mini | Code snippet | 4.4.3 | 193.66M | JIT | All errors | 57 μs | 94.81x | |||
zod | Code snippet | 4.4.3 | 193.66M | JIT | All errors | 62 μs | 102.6x | |||
zod (jitless) | Code snippet | 4.4.3 | 193.66M | None | All errors | 69 μs | 113.36x | |||
superstruct | Code snippet | 2.0.2 | 5.29M | None | All errors | 74 μs | 122.58x | |||
superstruct | Code snippet | 2.0.2 | 5.29M | None | All errors | 74 μs | 122.78x | |||
decoders | Code snippet | 2.9.3 | 65.91K | None | All errors | 77 μs | 128.05x | |||
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.39 | 4.68M | JIT | All errors | 81 μs | 133.69x | ||
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 | 85 μs | 139.89x | ||
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.39 | 4.68M | JIT | All errors | 86 μs | 141.55x | ||
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.39 | 4.68M | JIT | All errors | 87 μs | 144.4x | ||
arktype | Code snippet | 2.2.0 | 1.15M | JIT | All errors | 89 μs | 146.99x | |||
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.39 | 4.68M | JIT | All errors | 91 μs | 150.71x | ||
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.39 | 4.68M | JIT | All errors | 94 μs | 155.92x | ||
runtypes | Code snippet | 7.0.4 | 320.04K | None | Abort early | 171 μs | 283.07x | |||
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 | 181 μs | 299.66x | ||
@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 | 258 μs | 427.25x | ||
@sapphire/shapeshift (run) | Code snippet | 4.0.0 | 889.36K | None | All errors | 259 μs | 427.98x | |||
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 | 476 μs | 788.09x | ||