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 | 648 ns | ||||
valibot | Code snippet | 1.4.1 | 12.21M | None | Abort early | 728 ns | 1.12x | |||
effect@beta | Code snippet(Commented code is not benchmarked) | 4.0.0-beta.71 | 18.38M | None | Abort early | 1 μs | 2.08x | |||
joi | Code snippet | 18.2.1 | 22.51M | None | Abort early | 4 μs | 6.37x | |||
typia (createValidate) | Code snippet(Commented code is not benchmarked) | 12.1.1 | 321.84K | Precompiled | All errors | 6 μs | 9.65x | |||
io-ts | Code snippet | 2.2.22 | 3.76M | None | All errors | 6 μs | 9.68x | |||
typia (validate) | Code snippet | 12.1.1 | 321.84K | Precompiled | All errors | 7 μs | 10.32x | |||
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.6 | 190.79K | JIT | All errors | 7 μs | 11.14x | ||
sury (safe) | Code snippet | 11.0.0-alpha.6 | 190.79K | JIT | All errors | 8 μs | 11.81x | |||
effect | Code snippet(Commented code is not benchmarked) | 3.21.2 | 18.38M | None | Abort early | 9 μs | 14.25x | |||
superstruct | Code snippet | 2.0.2 | 5.29M | None | Abort early | 10 μs | 15.18x | |||
superstruct (schema.validate) | Code snippet | 2.0.2 | 5.29M | None | Abort early | 10 μs | 15.69x | |||
valibot | Code snippet | 1.4.1 | 12.21M | None | All errors | 28 μs | 42.8x | |||
valibot (abortPipeEarly only) | Code snippet | 1.4.1 | 12.21M | None | Abort early | 28 μs | 43.06x | |||
effect | Code snippet(Commented code is not benchmarked) | 3.21.2 | 18.38M | None | All errors | 31 μs | 47.34x | |||
@railway-ts/pipelines | Code snippet | 0.1.29 | 105 | None | All errors | 31 μs | 47.4x | |||
effect@beta | Code snippet(Commented code is not benchmarked) | 4.0.0-beta.71 | 18.38M | None | All errors | 31 μs | 48.18x | |||
ata-validator | Code snippet | 0.18.2 | 499 | JIT | All errors | 32 μs | 48.97x | |||
zod/v3 | Code snippet | 4.4.3 | 193.66M | None | All errors | 38 μs | 58.96x | |||
joi | Code snippet | 18.2.1 | 22.51M | None | All errors | 56 μs | 86.45x | |||
zod/mini (jitless) | Code snippet | 4.4.3 | 193.66M | None | All errors | 58 μs | 89.85x | |||
zod/mini | Code snippet | 4.4.3 | 193.66M | JIT | All errors | 58 μs | 90.27x | |||
zod | Code snippet | 4.4.3 | 193.66M | JIT | All errors | 64 μs | 98.76x | |||
zod (jitless) | Code snippet | 4.4.3 | 193.66M | None | All errors | 70 μs | 108.69x | |||
superstruct | Code snippet | 2.0.2 | 5.29M | None | All errors | 77 μs | 118.65x | |||
superstruct | Code snippet | 2.0.2 | 5.29M | None | All errors | 77 μs | 118.91x | |||
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 | 4.68M | JIT | All errors | 81 μs | 125.69x | ||
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 | 4.68M | JIT | All errors | 84 μs | 129.52x | ||
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 | 84 μs | 130.15x | ||
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 | 4.68M | JIT | All errors | 87 μs | 134.51x | ||
arktype | Code snippet | 2.2.0 | 1.15M | JIT | All errors | 90 μs | 139.16x | |||
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 | 4.68M | JIT | All errors | 90 μs | 139.64x | ||
decoders | Code snippet | 2.9.3 | 65.91K | None | All errors | 91 μs | 140.27x | |||
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 | 4.68M | JIT | All errors | 100 μs | 154.52x | ||
runtypes | Code snippet | 7.0.4 | 320.04K | None | Abort early | 174 μs | 268.25x | |||
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 | 183 μs | 282.59x | ||
@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 | 259 μs | 399.81x | ||
@sapphire/shapeshift (run) | Code snippet | 4.0.0 | 889.36K | None | All errors | 261 μs | 402.28x | |||
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 | 483 μs | 745.58x | ||