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 | 645 ns | ||||
valibot | Code snippet | 1.4.2 | 13.65M | None | Abort early | 757 ns | 1.17x | |||
effect@beta | Code snippet(Commented code is not benchmarked) | 4.0.0-beta.97 | 17.39M | None | Abort early | 1 μs | 1.84x | |||
joi | Code snippet | 18.2.3 | 16.97M | None | Abort early | 4 μs | 6.09x | |||
io-ts | Code snippet | 2.2.22 | 2.36M | None | All errors | 6 μs | 9.04x | |||
typia (createValidate) | Code snippet(Commented code is not benchmarked) | 13.0.2 | 292.71K | Precompiled | All errors | 7 μs | 10.45x | |||
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 | 199.54K | JIT | All errors | 7 μs | 11.12x | ||
typia (validate) | Code snippet | 13.0.2 | 292.71K | Precompiled | All errors | 7 μs | 11.17x | |||
sury (safe) | Code snippet | 11.0.0-alpha.9 | 199.54K | JIT | All errors | 8 μs | 11.81x | |||
effect | Code snippet(Commented code is not benchmarked) | 3.21.4 | 17.39M | None | Abort early | 9 μs | 14.11x | |||
superstruct | Code snippet | 2.0.2 | 5.15M | None | Abort early | 10 μs | 15.83x | |||
superstruct (schema.validate) | Code snippet | 2.0.2 | 5.15M | None | Abort early | 10 μs | 16.03x | |||
effect@beta | Code snippet(Commented code is not benchmarked) | 4.0.0-beta.97 | 17.39M | None | All errors | 26 μs | 40.75x | |||
valibot (abortPipeEarly only) | Code snippet | 1.4.2 | 13.65M | None | Abort early | 28 μs | 43.66x | |||
valibot | Code snippet | 1.4.2 | 13.65M | None | All errors | 28 μs | 44.16x | |||
@railway-ts/pipelines | Code snippet | 0.1.29 | 37 | None | All errors | 30 μs | 47.18x | |||
effect | Code snippet(Commented code is not benchmarked) | 3.21.4 | 17.39M | None | All errors | 31 μs | 48.24x | |||
ata-validator | Code snippet | 0.21.0 | 399 | JIT | All errors | 35 μs | 53.59x | |||
zod/v3 | Code snippet | 4.4.3 | 210.15M | None | All errors | 39 μs | 60.73x | |||
joi | Code snippet | 18.2.3 | 16.97M | None | All errors | 62 μs | 96.62x | |||
decoders | Code snippet | 2.9.3 | 53.59K | None | All errors | 65 μs | 101.27x | |||
zod/mini (jitless) | Code snippet | 4.4.3 | 210.15M | None | All errors | 65 μs | 101.37x | |||
zod/mini | Code snippet | 4.4.3 | 210.15M | JIT | All errors | 66 μs | 101.94x | |||
zod | Code snippet | 4.4.3 | 210.15M | JIT | All errors | 76 μs | 117.47x | |||
superstruct | Code snippet | 2.0.2 | 5.15M | None | All errors | 79 μs | 122.83x | |||
superstruct | Code snippet | 2.0.2 | 5.15M | None | All errors | 79 μs | 122.97x | |||
zod (jitless) | Code snippet | 4.4.3 | 210.15M | None | All errors | 81 μs | 125.04x | |||
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.6 | 3.67M | JIT | All errors | 81 μs | 125.31x | ||
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.6 | 3.67M | JIT | All errors | 86 μs | 133x | ||
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.6 | 3.67M | JIT | All errors | 90 μs | 138.96x | ||
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.6 | 3.67M | JIT | All errors | 91 μs | 141.15x | ||
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 | 95 μs | 146.76x | ||
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.6 | 3.67M | JIT | All errors | 97 μs | 150.08x | ||
arktype | Code snippet | 2.2.3 | 1.15M | JIT | All errors | 100 μs | 155.57x | |||
runtypes | Code snippet | 7.0.4 | 232.54K | None | Abort early | 187 μs | 289.83x | |||
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 | 204 μs | 316x | ||
@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 | 272 μs | 422.46x | ||
@sapphire/shapeshift (run) | Code snippet | 4.0.0 | 773.13K | None | All errors | 276 μs | 428.05x | |||
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 | 527 μs | 817.7x | ||