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.28 | 331 | None | Abort early | 620 ns | ||||
valibot | Code snippet | 1.3.1 | 8.29M | None | Abort early | 705 ns | 1.14x | |||
effect@beta | Code snippet | 4.0.0-beta.50 | 10.92M | None | Abort early | 1 μs | 1.89x | |||
ata-validator | Code snippet | 0.10.2 | 944 | JIT | All errors | 2 μs | 3.69x | |||
joi | Code snippet | 18.1.2 | 18.47M | None | Abort early | 4 μs | 6.6x | |||
typia (createValidate) | Code snippet | 12.0.2 | 248.67K | Precompiled | All errors | 6 μs | 10.03x | |||
io-ts | Code snippet | 2.2.22 | 2.94M | None | All errors | 6 μs | 10.05x | |||
typia (validate) | Code snippet | 12.0.2 | 248.67K | Precompiled | All errors | 7 μs | 10.56x | |||
sury (compile + safe) | Code snippet | 11.0.0-alpha.4 | 152.75K | JIT | All errors | 8 μs | 12.32x | |||
sury (compile) | 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 | 152.75K | JIT | All errors | 8 μs | 12.42x | ||
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 | 152.75K | JIT | All errors | 8 μs | 12.71x | ||
sury (safe) | Code snippet | 11.0.0-alpha.4 | 152.75K | JIT | All errors | 8 μs | 12.76x | |||
effect | Code snippet | 3.21.1 | 10.92M | None | Abort early | 10 μs | 15.51x | |||
superstruct | Code snippet | 2.0.2 | 4.19M | None | Abort early | 10 μs | 15.94x | |||
superstruct (schema.validate) | Code snippet | 2.0.2 | 4.19M | None | Abort early | 10 μs | 16.27x | |||
effect@beta | Code snippet | 4.0.0-beta.50 | 10.92M | None | All errors | 20 μs | 32.55x | |||
valibot (abortPipeEarly only) | Code snippet | 1.3.1 | 8.29M | None | Abort early | 27 μs | 43.44x | |||
valibot | Code snippet | 1.3.1 | 8.29M | None | All errors | 27 μs | 43.96x | |||
@railway-ts/pipelines | Code snippet | 0.1.28 | 331 | None | All errors | 29 μs | 47x | |||
zod/v3 | Code snippet | 4.3.6 | 158.87M | None | All errors | 39 μs | 62.55x | |||
effect | Code snippet | 3.21.1 | 10.92M | None | All errors | 43 μs | 68.65x | |||
joi | Code snippet | 18.1.2 | 18.47M | None | All errors | 55 μs | 88.9x | |||
zod/mini (jitless) | Code snippet | 4.3.6 | 158.87M | None | All errors | 64 μs | 102.74x | |||
zod/mini | Code snippet | 4.3.6 | 158.87M | JIT | All errors | 64 μs | 103.37x | |||
zod | Code snippet | 4.3.6 | 158.87M | JIT | All errors | 74 μs | 118.67x | |||
superstruct | Code snippet | 2.0.2 | 4.19M | None | All errors | 74 μs | 118.99x | |||
superstruct | Code snippet | 2.0.2 | 4.19M | None | All errors | 74 μs | 119.78x | |||
typebox (schema compile) | 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.27 | 285.25K | JIT | All errors | 76 μs | 121.89x | ||
zod (jitless) | Code snippet | 4.3.6 | 158.87M | None | All errors | 79 μs | 128.26x | |||
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.27 | 285.25K | JIT | All errors | 82 μs | 132.7x | ||
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.6M | None | Abort early | 84 μs | 135.52x | ||
typebox (compile) | 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.27 | 285.25K | JIT | All errors | 84 μs | 135.8x | ||
decoders | Code snippet | 2.9.3 | 34.32K | None | All errors | 88 μs | 141.33x | |||
arktype | Code snippet | 2.2.0 | 831.59K | JIT | All errors | 90 μs | 145.58x | |||
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.27 | 285.25K | JIT | All errors | 91 μs | 146.28x | ||
runtypes | Code snippet | 7.0.4 | 285.77K | None | Abort early | 172 μs | 276.75x | |||
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 | 285.77K | None | Abort early | 181 μs | 291.97x | ||
@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 | 653.71K | None | All errors | 259 μs | 418.66x | ||
@sapphire/shapeshift (run) | Code snippet | 4.0.0 | 653.71K | None | All errors | 260 μs | 420.09x | |||
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.6M | None | All errors | 483 μs | 778.51x | ||