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 | 24 | None | Abort early | 643 ns | ||||
valibot | Code snippet | 1.4.2 | 13.57M | None | Abort early | 669 ns | 1.04x | |||
effect@beta | Code snippet(Commented code is not benchmarked) | 4.0.0-beta.93 | 16.97M | None | Abort early | 1 μs | 2.08x | |||
joi | Code snippet | 18.2.3 | 16.86M | None | Abort early | 4 μs | 6.28x | |||
io-ts | Code snippet | 2.2.22 | 2.34M | None | All errors | 6 μs | 9.58x | |||
typia (createValidate) | Code snippet(Commented code is not benchmarked) | 12.1.1 | 298.11K | Precompiled | All errors | 6 μs | 9.64x | |||
typia (validate) | Code snippet | 12.1.1 | 298.11K | Precompiled | All errors | 6 μs | 10.02x | |||
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.9 | 207.16K | JIT | All errors | 7 μs | 10.9x | ||
sury (safe) | Code snippet | 11.0.0-alpha.9 | 207.16K | JIT | All errors | 7 μs | 11.47x | |||
effect | Code snippet(Commented code is not benchmarked) | 3.21.4 | 16.97M | None | Abort early | 9 μs | 14.12x | |||
superstruct | Code snippet | 2.0.2 | 5.1M | None | Abort early | 10 μs | 15.06x | |||
superstruct (schema.validate) | Code snippet | 2.0.2 | 5.1M | None | Abort early | 10 μs | 15.39x | |||
effect@beta | Code snippet(Commented code is not benchmarked) | 4.0.0-beta.93 | 16.97M | None | All errors | 21 μs | 32.99x | |||
valibot (abortPipeEarly only) | Code snippet | 1.4.2 | 13.57M | None | Abort early | 27 μs | 41.85x | |||
valibot | Code snippet | 1.4.2 | 13.57M | None | All errors | 27 μs | 42.56x | |||
@railway-ts/pipelines | Code snippet | 0.1.29 | 24 | None | All errors | 29 μs | 45.48x | |||
effect | Code snippet(Commented code is not benchmarked) | 3.21.4 | 16.97M | None | All errors | 30 μs | 46.69x | |||
ata-validator | Code snippet | 0.21.0 | 443 | JIT | All errors | 31 μs | 47.6x | |||
zod/v3 | Code snippet | 4.4.3 | 208.07M | None | All errors | 43 μs | 66.92x | |||
joi | Code snippet | 18.2.3 | 16.86M | None | All errors | 55 μs | 85.62x | |||
zod/mini (jitless) | Code snippet | 4.4.3 | 208.07M | None | All errors | 57 μs | 88.47x | |||
zod/mini | Code snippet | 4.4.3 | 208.07M | JIT | All errors | 57 μs | 88.92x | |||
zod | Code snippet | 4.4.3 | 208.07M | JIT | All errors | 63 μs | 97.5x | |||
zod (jitless) | Code snippet | 4.4.3 | 208.07M | None | All errors | 69 μs | 107.27x | |||
superstruct | Code snippet | 2.0.2 | 5.1M | None | All errors | 74 μs | 115.06x | |||
superstruct | Code snippet | 2.0.2 | 5.1M | None | All errors | 74 μs | 115.47x | |||
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.3.3 | 3.4M | JIT | All errors | 78 μs | 121.46x | ||
decoders | Code snippet | 2.9.3 | 53.18K | None | All errors | 82 μs | 128.02x | |||
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 | 9.42M | None | Abort early | 84 μs | 130.33x | ||
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.3.3 | 3.4M | JIT | All errors | 84 μs | 130.47x | ||
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.3.3 | 3.4M | JIT | All errors | 86 μs | 133.31x | ||
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.3.3 | 3.4M | JIT | All errors | 87 μs | 135.17x | ||
arktype | Code snippet | 2.2.2 | 1.15M | JIT | All errors | 89 μs | 138.46x | |||
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.3.3 | 3.4M | JIT | All errors | 92 μs | 142.35x | ||
runtypes | Code snippet | 7.0.4 | 238.13K | None | Abort early | 168 μs | 261.96x | |||
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 | 238.13K | None | Abort early | 179 μs | 277.82x | ||
@sapphire/shapeshift (run) | Code snippet | 4.0.0 | 764.24K | None | All errors | 269 μs | 417.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 | 764.24K | None | All errors | 270 μs | 420.72x | ||
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 | 9.42M | None | All errors | 488 μs | 759.37x | ||