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 | 37 | None | Abort early | 673 ns | ||||
valibot | Code snippet | 1.4.1 | 13.65M | None | Abort early | 760 ns | 1.13x | |||
effect@beta | Code snippet(Commented code is not benchmarked) | 4.0.0-beta.85 | 17.39M | None | Abort early | 1 μs | 1.77x | |||
joi | Code snippet | 18.2.3 | 16.97M | None | Abort early | 4 μs | 5.9x | |||
io-ts | Code snippet | 2.2.22 | 2.36M | None | All errors | 6 μs | 8.73x | |||
typia (createValidate) | Code snippet(Commented code is not benchmarked) | 12.1.1 | 292.71K | Precompiled | All errors | 6 μs | 9.61x | |||
typia (validate) | Code snippet | 12.1.1 | 292.71K | Precompiled | All errors | 7 μs | 10.14x | |||
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.8 | 199.54K | JIT | All errors | 7 μs | 10.76x | ||
sury (safe) | Code snippet | 11.0.0-alpha.8 | 199.54K | JIT | All errors | 7 μs | 11x | |||
effect | Code snippet(Commented code is not benchmarked) | 3.21.4 | 17.39M | None | Abort early | 9 μs | 13.85x | |||
superstruct | Code snippet | 2.0.2 | 5.15M | None | Abort early | 10 μs | 15.44x | |||
superstruct (schema.validate) | Code snippet | 2.0.2 | 5.15M | None | Abort early | 10 μs | 15.53x | |||
effect@beta | Code snippet(Commented code is not benchmarked) | 4.0.0-beta.85 | 17.39M | None | All errors | 21 μs | 30.48x | |||
valibot (abortPipeEarly only) | Code snippet | 1.4.1 | 13.65M | None | Abort early | 29 μs | 42.37x | |||
valibot | Code snippet | 1.4.1 | 13.65M | None | All errors | 29 μs | 42.46x | |||
@railway-ts/pipelines | Code snippet | 0.1.29 | 37 | None | All errors | 31 μs | 45.38x | |||
effect | Code snippet(Commented code is not benchmarked) | 3.21.4 | 17.39M | None | All errors | 33 μs | 48.41x | |||
ata-validator | Code snippet | 0.21.0 | 399 | JIT | All errors | 35 μs | 51.91x | |||
zod/v3 | Code snippet | 4.4.3 | 210.15M | None | All errors | 40 μs | 59.47x | |||
joi | Code snippet | 18.2.3 | 16.97M | None | All errors | 62 μs | 91.45x | |||
zod/mini (jitless) | Code snippet | 4.4.3 | 210.15M | None | All errors | 66 μs | 97.75x | |||
zod/mini | Code snippet | 4.4.3 | 210.15M | JIT | All errors | 66 μs | 97.78x | |||
decoders | Code snippet | 2.9.3 | 53.59K | None | All errors | 77 μs | 114.75x | |||
zod | Code snippet | 4.4.3 | 210.15M | JIT | All errors | 78 μs | 115.54x | |||
superstruct | Code snippet | 2.0.2 | 5.15M | None | All errors | 81 μs | 120.99x | |||
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.0 | 3.67M | JIT | All errors | 82 μs | 121.1x | ||
superstruct | Code snippet | 2.0.2 | 5.15M | None | All errors | 82 μs | 121.84x | |||
zod (jitless) | Code snippet | 4.4.3 | 210.15M | None | All errors | 84 μs | 124.16x | |||
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.0 | 3.67M | JIT | All errors | 85 μs | 126.78x | ||
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.0 | 3.67M | JIT | All errors | 89 μs | 132.81x | ||
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.0 | 3.67M | JIT | All errors | 91 μs | 134.43x | ||
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.0 | 3.67M | JIT | All errors | 97 μs | 144.01x | ||
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.31M | None | Abort early | 98 μs | 144.87x | ||
arktype | Code snippet | 2.2.1 | 1.15M | JIT | All errors | 99 μs | 147.26x | |||
runtypes | Code snippet | 7.0.4 | 232.54K | None | Abort early | 195 μs | 289.91x | |||
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 | 232.54K | None | Abort early | 212 μs | 315.19x | ||
@sapphire/shapeshift (run) | Code snippet | 4.0.0 | 773.13K | None | All errors | 277 μs | 410.89x | |||
@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 | 773.13K | None | All errors | 277 μs | 411.75x | ||
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.31M | None | All errors | 532 μs | 790.46x | ||