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 | 650 ns | ||||
valibot | Code snippet | 1.4.2 | 13.57M | None | Abort early | 794 ns | 1.22x | |||
effect@beta | Code snippet(Commented code is not benchmarked) | 4.0.0-beta.93 | 16.97M | None | Abort early | 1 μs | 2.04x | |||
joi | Code snippet | 18.2.3 | 16.86M | None | Abort early | 4 μs | 6.04x | |||
io-ts | Code snippet | 2.2.22 | 2.34M | None | All errors | 6 μs | 9.11x | |||
typia (createValidate) | Code snippet(Commented code is not benchmarked) | 12.1.1 | 298.11K | Precompiled | All errors | 7 μs | 10.11x | |||
typia (validate) | Code snippet | 12.1.1 | 298.11K | Precompiled | All errors | 7 μs | 10.64x | |||
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 | 11.29x | ||
sury (safe) | Code snippet | 11.0.0-alpha.9 | 207.16K | JIT | All errors | 8 μs | 11.64x | |||
effect | Code snippet(Commented code is not benchmarked) | 3.21.4 | 16.97M | None | Abort early | 10 μs | 14.71x | |||
superstruct | Code snippet | 2.0.2 | 5.1M | None | Abort early | 10 μs | 15.47x | |||
superstruct (schema.validate) | Code snippet | 2.0.2 | 5.1M | None | Abort early | 10 μs | 16.07x | |||
valibot | Code snippet | 1.4.2 | 13.57M | None | All errors | 29 μs | 45.3x | |||
valibot (abortPipeEarly only) | Code snippet | 1.4.2 | 13.57M | None | Abort early | 30 μs | 45.68x | |||
effect@beta | Code snippet(Commented code is not benchmarked) | 4.0.0-beta.93 | 16.97M | None | All errors | 30 μs | 46.73x | |||
@railway-ts/pipelines | Code snippet | 0.1.29 | 24 | None | All errors | 30 μs | 46.78x | |||
effect | Code snippet(Commented code is not benchmarked) | 3.21.4 | 16.97M | None | All errors | 32 μs | 49.27x | |||
ata-validator | Code snippet | 0.21.0 | 443 | JIT | All errors | 34 μs | 51.52x | |||
zod/v3 | Code snippet | 4.4.3 | 208.07M | None | All errors | 40 μs | 61.43x | |||
joi | Code snippet | 18.2.3 | 16.86M | None | All errors | 62 μs | 95.75x | |||
zod/mini (jitless) | Code snippet | 4.4.3 | 208.07M | None | All errors | 66 μs | 100.73x | |||
decoders | Code snippet | 2.9.3 | 53.18K | None | All errors | 66 μs | 102.17x | |||
zod/mini | Code snippet | 4.4.3 | 208.07M | JIT | All errors | 67 μs | 102.3x | |||
zod | Code snippet | 4.4.3 | 208.07M | JIT | All errors | 76 μs | 117.13x | |||
superstruct | Code snippet | 2.0.2 | 5.1M | None | All errors | 80 μs | 122.49x | |||
superstruct | Code snippet | 2.0.2 | 5.1M | None | All errors | 80 μs | 123.41x | |||
zod (jitless) | Code snippet | 4.4.3 | 208.07M | None | All errors | 82 μs | 125.58x | |||
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 | 82 μs | 126.82x | ||
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 | 87 μs | 133.93x | ||
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 | 92 μs | 141.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.3.3 | 3.4M | JIT | All errors | 93 μs | 142.34x | ||
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 | 96 μs | 148.37x | ||
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 | 98 μs | 151.18x | ||
arktype | Code snippet | 2.2.2 | 1.15M | JIT | All errors | 99 μs | 152.34x | |||
runtypes | Code snippet | 7.0.4 | 238.13K | None | Abort early | 191 μs | 294.12x | |||
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 | 207 μs | 318.86x | ||
@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 | 274 μs | 421.87x | ||
@sapphire/shapeshift (run) | Code snippet | 4.0.0 | 764.24K | None | All errors | 277 μs | 425.47x | |||
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 | 546 μs | 838.83x | ||