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 | 52 | None | Abort early | 652 ns | ||||
valibot | Code snippet | 1.4.0 | 11.35M | None | Abort early | 778 ns | 1.19x | |||
effect@beta | Code snippet(Commented code is not benchmarked) | 4.0.0-beta.70 | 15.22M | None | Abort early | 1 μs | 1.75x | |||
joi | Code snippet | 18.2.1 | 21.05M | None | Abort early | 4 μs | 6.21x | |||
io-ts | Code snippet | 2.2.22 | 3.22M | None | All errors | 6 μs | 9.24x | |||
typia (createValidate) | Code snippet(Commented code is not benchmarked) | 12.1.1 | 308.56K | Precompiled | All errors | 7 μs | 10.06x | |||
typia (validate) | Code snippet | 12.1.1 | 308.56K | Precompiled | All errors | 7 μs | 10.39x | |||
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.5 | 230.14K | JIT | All errors | 7 μs | 11.1x | ||
sury (safe) | Code snippet | 11.0.0-alpha.5 | 230.14K | JIT | All errors | 8 μs | 11.89x | |||
effect | Code snippet(Commented code is not benchmarked) | 3.21.2 | 15.22M | None | Abort early | 9 μs | 14.25x | |||
superstruct | Code snippet | 2.0.2 | 5.17M | None | Abort early | 10 μs | 15.39x | |||
superstruct (schema.validate) | Code snippet | 2.0.2 | 5.17M | None | Abort early | 10 μs | 15.67x | |||
effect@beta | Code snippet(Commented code is not benchmarked) | 4.0.0-beta.70 | 15.22M | None | All errors | 20 μs | 30.36x | |||
valibot | Code snippet | 1.4.0 | 11.35M | None | All errors | 30 μs | 45.29x | |||
valibot (abortPipeEarly only) | Code snippet | 1.4.0 | 11.35M | None | Abort early | 30 μs | 45.33x | |||
@railway-ts/pipelines | Code snippet | 0.1.29 | 52 | None | All errors | 30 μs | 46.61x | |||
effect | Code snippet(Commented code is not benchmarked) | 3.21.2 | 15.22M | None | All errors | 31 μs | 47.71x | |||
ata-validator | Code snippet | 0.15.0 | 1.22K | JIT | All errors | 34 μs | 52.28x | |||
zod/v3 | Code snippet | 4.4.3 | 182.46M | None | All errors | 40 μs | 61.26x | |||
joi | Code snippet | 18.2.1 | 21.05M | None | All errors | 62 μs | 94.74x | |||
zod/mini (jitless) | Code snippet | 4.4.3 | 182.46M | None | All errors | 64 μs | 98.76x | |||
zod/mini | Code snippet | 4.4.3 | 182.46M | JIT | All errors | 64 μs | 98.95x | |||
decoders | Code snippet | 2.9.3 | 53.24K | None | All errors | 66 μs | 100.85x | |||
zod | Code snippet | 4.4.3 | 182.46M | JIT | All errors | 77 μs | 117.43x | |||
superstruct | Code snippet | 2.0.2 | 5.17M | None | All errors | 79 μs | 121.02x | |||
superstruct | Code snippet | 2.0.2 | 5.17M | None | All errors | 79 μs | 121.29x | |||
zod (jitless) | Code snippet | 4.4.3 | 182.46M | None | All errors | 82 μs | 125.93x | |||
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 | 2.25M | JIT | All errors | 84 μs | 128.92x | ||
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 | 2.25M | JIT | All errors | 88 μs | 135.23x | ||
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 | 2.25M | JIT | All errors | 92 μs | 141.19x | ||
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 | 2.25M | JIT | All errors | 94 μs | 143.94x | ||
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.8M | None | Abort early | 96 μs | 146.88x | ||
arktype | Code snippet | 2.2.0 | 976.91K | JIT | All errors | 98 μs | 150.54x | |||
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 | 2.25M | JIT | All errors | 99 μs | 151.79x | ||
runtypes | Code snippet | 7.0.4 | 298.1K | None | Abort early | 189 μs | 290.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 | 298.1K | None | Abort early | 205 μs | 315.02x | ||
@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 | 901.24K | None | All errors | 272 μs | 417.39x | ||
@sapphire/shapeshift (run) | Code snippet | 4.0.0 | 901.24K | None | All errors | 275 μs | 422.74x | |||
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.8M | None | All errors | 537 μs | 823.69x | ||