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 | 47 | None | Abort early | 623 ns | ||||
valibot | Code snippet | 1.4.1 | 11.77M | None | Abort early | 667 ns | 1.07x | |||
effect@beta | Code snippet(Commented code is not benchmarked) | 4.0.0-beta.78 | 19.4M | None | Abort early | 1 μs | 2.13x | |||
joi | Code snippet | 18.2.1 | 20.9M | None | Abort early | 4 μs | 6.58x | |||
io-ts | Code snippet | 2.2.22 | 3.14M | None | All errors | 6 μs | 9.68x | |||
typia (createValidate) | Code snippet(Commented code is not benchmarked) | 12.1.1 | 282.55K | Precompiled | All errors | 6 μs | 10.08x | |||
typia (validate) | Code snippet | 12.1.1 | 282.55K | Precompiled | All errors | 7 μs | 10.6x | |||
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 | 263.43K | JIT | All errors | 7 μs | 10.86x | ||
sury (safe) | Code snippet | 11.0.0-alpha.7 | 263.43K | JIT | All errors | 8 μs | 12.06x | |||
effect | Code snippet(Commented code is not benchmarked) | 3.21.3 | 19.4M | None | Abort early | 9 μs | 14.72x | |||
superstruct (schema.validate) | Code snippet | 2.0.2 | 5.31M | None | Abort early | 10 μs | 16.12x | |||
superstruct | Code snippet | 2.0.2 | 5.31M | None | Abort early | 10 μs | 16.5x | |||
valibot (abortPipeEarly only) | Code snippet | 1.4.1 | 11.77M | None | Abort early | 27 μs | 43.88x | |||
valibot | Code snippet | 1.4.1 | 11.77M | None | All errors | 27 μs | 44.15x | |||
@railway-ts/pipelines | Code snippet | 0.1.29 | 47 | None | All errors | 29 μs | 47.06x | |||
effect | Code snippet(Commented code is not benchmarked) | 3.21.3 | 19.4M | None | All errors | 30 μs | 48.25x | |||
ata-validator | Code snippet | 0.21.0 | 1.11K | JIT | All errors | 30 μs | 48.94x | |||
effect@beta | Code snippet(Commented code is not benchmarked) | 4.0.0-beta.78 | 19.4M | None | All errors | 31 μs | 49.17x | |||
zod/v3 | Code snippet | 4.4.3 | 185.36M | None | All errors | 37 μs | 60x | |||
joi | Code snippet | 18.2.1 | 20.9M | None | All errors | 56 μs | 89.46x | |||
zod/mini (jitless) | Code snippet | 4.4.3 | 185.36M | None | All errors | 57 μs | 90.88x | |||
zod/mini | Code snippet | 4.4.3 | 185.36M | JIT | All errors | 57 μs | 91.78x | |||
zod | Code snippet | 4.4.3 | 185.36M | JIT | All errors | 63 μs | 100.71x | |||
zod (jitless) | Code snippet | 4.4.3 | 185.36M | None | All errors | 69 μs | 110.71x | |||
superstruct | Code snippet | 2.0.2 | 5.31M | None | All errors | 74 μs | 118.38x | |||
superstruct | Code snippet | 2.0.2 | 5.31M | None | All errors | 74 μs | 119.42x | |||
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.17M | JIT | All errors | 80 μs | 128.36x | ||
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.72M | None | Abort early | 83 μs | 133.84x | ||
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.17M | JIT | All errors | 86 μs | 137.47x | ||
decoders | Code snippet | 2.9.3 | 56.59K | None | All errors | 86 μs | 138.01x | |||
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.17M | JIT | All errors | 87 μs | 140.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.17M | JIT | All errors | 90 μs | 144.72x | ||
arktype | Code snippet | 2.2.0 | 1.1M | JIT | All errors | 91 μs | 145.48x | |||
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.17M | JIT | All errors | 94 μs | 151.42x | ||
runtypes | Code snippet | 7.0.4 | 312.8K | None | Abort early | 172 μs | 276.72x | |||
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 | 312.8K | None | Abort early | 182 μs | 291.71x | ||
@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 | 786.16K | None | All errors | 262 μs | 421.04x | ||
@sapphire/shapeshift (run) | Code snippet | 4.0.0 | 786.16K | None | All errors | 262 μs | 421.53x | |||
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.72M | None | All errors | 481 μs | 773.08x | ||