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.27 | 34 | None | Abort early | 643 ns | ||||
ata-validator | Code snippet | 0.8.0 | 728 | JIT | All errors | 682 ns | 1.06x | |||
valibot | Code snippet | 1.3.1 | 7.93M | None | Abort early | 701 ns | 1.09x | |||
effect@beta | Code snippet(Commented code is not benchmarked) | 4.0.0-beta.46 | 9.44M | None | Abort early | 1 μs | 1.83x | |||
joi | Code snippet | 18.1.2 | 18.77M | None | Abort early | 4 μs | 6.28x | |||
typia (createValidate) | Code snippet(Commented code is not benchmarked) | 12.0.2 | 259.06K | Precompiled | All errors | 6 μs | 9.48x | |||
io-ts | Code snippet | 2.2.22 | 2.92M | None | All errors | 6 μs | 9.54x | |||
typia (validate) | Code snippet | 12.0.2 | 259.06K | Precompiled | All errors | 6 μs | 10.01x | |||
sury (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. | 11.0.0-alpha.4 | 146.04K | JIT | All errors | 7 μs | 11.45x | ||
sury (compile + safe) | Code snippet(Commented code is not benchmarked) | 11.0.0-alpha.4 | 146.04K | JIT | All errors | 8 μs | 11.96x | |||
sury (safe) | Code snippet | 11.0.0-alpha.4 | 146.04K | JIT | All errors | 8 μs | 12.17x | |||
sury | 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. | 11.0.0-alpha.4 | 146.04K | JIT | All errors | 8 μs | 12.22x | ||
effect | Code snippet(Commented code is not benchmarked) | 3.21.0 | 9.44M | None | Abort early | 9 μs | 14.67x | |||
superstruct | Code snippet | 2.0.2 | 4.08M | None | Abort early | 10 μs | 15.36x | |||
superstruct (schema.validate) | Code snippet | 2.0.2 | 4.08M | None | Abort early | 10 μs | 15.76x | |||
effect@beta | Code snippet(Commented code is not benchmarked) | 4.0.0-beta.46 | 9.44M | None | All errors | 22 μs | 33.6x | |||
valibot | Code snippet | 1.3.1 | 7.93M | None | All errors | 27 μs | 41.82x | |||
valibot (abortPipeEarly only) | Code snippet | 1.3.1 | 7.93M | None | Abort early | 28 μs | 42.92x | |||
@railway-ts/pipelines | Code snippet | 0.1.27 | 34 | None | All errors | 29 μs | 45.24x | |||
effect | Code snippet(Commented code is not benchmarked) | 3.21.0 | 9.44M | None | All errors | 31 μs | 47.9x | |||
zod/v3 | Code snippet | 4.3.6 | 151.14M | None | All errors | 37 μs | 57.88x | |||
joi | Code snippet | 18.1.2 | 18.77M | None | All errors | 55 μs | 85.51x | |||
zod/mini | Code snippet | 4.3.6 | 151.14M | JIT | All errors | 64 μs | 99.04x | |||
zod/mini (jitless) | Code snippet | 4.3.6 | 151.14M | None | All errors | 64 μs | 99.11x | |||
zod | Code snippet | 4.3.6 | 151.14M | JIT | All errors | 73 μs | 114.01x | |||
decoders | Code snippet | 2.9.3 | 36.8K | None | All errors | 74 μs | 114.32x | |||
superstruct | Code snippet | 2.0.2 | 4.08M | None | All errors | 74 μs | 115.07x | |||
superstruct | Code snippet | 2.0.2 | 4.08M | None | All errors | 75 μs | 115.94x | |||
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.23 | 277.92K | JIT | All errors | 76 μs | 118.6x | ||
zod (jitless) | Code snippet | 4.3.6 | 151.14M | None | All errors | 78 μs | 121.87x | |||
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.23 | 277.92K | JIT | All errors | 80 μs | 124.41x | ||
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.23 | 277.92K | JIT | All errors | 82 μs | 128.1x | ||
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 | 10.83M | None | Abort early | 85 μs | 132.05x | ||
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.23 | 277.92K | JIT | All errors | 88 μs | 136.71x | ||
arktype | Code snippet | 2.2.0 | 885.45K | JIT | All errors | 91 μs | 141.01x | |||
runtypes | Code snippet | 7.0.4 | 279.42K | None | Abort early | 182 μs | 282.85x | |||
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 | 279.42K | None | Abort early | 185 μs | 287.99x | ||
@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 | 629.44K | None | All errors | 260 μs | 404.3x | ||
@sapphire/shapeshift (run) | Code snippet | 4.0.0 | 629.44K | None | All errors | 262 μs | 407.37x | |||
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 | 10.83M | None | All errors | 480 μs | 746.27x | ||