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 | 64 | None | Abort early | 648 ns | ||||
valibot | Code snippet | 1.3.1 | 6.74M | None | Abort early | 752 ns | 1.16x | |||
ata-validator | Code snippet | 0.7.3 | 993 | JIT | All errors | 762 ns | 1.18x | |||
effect@beta | Code snippet(Commented code is not benchmarked) | 4.0.0-beta.43 | 8.47M | None | Abort early | 1 μs | 1.69x | |||
joi | Code snippet | 18.1.2 | 16.45M | None | Abort early | 4 μs | 6.43x | |||
io-ts | Code snippet | 2.2.22 | 2.61M | None | All errors | 6 μs | 9.09x | |||
typia (createValidate) | Code snippet(Commented code is not benchmarked) | 12.0.2 | 214.48K | Precompiled | All errors | 6 μs | 9.73x | |||
typia (validate) | Code snippet | 12.0.2 | 214.48K | Precompiled | All errors | 7 μs | 10.3x | |||
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 | 105.04K | JIT | All errors | 8 μs | 12.41x | ||
sury (compile + safe) | Code snippet(Commented code is not benchmarked) | 11.0.0-alpha.4 | 105.04K | JIT | All errors | 8 μs | 12.6x | |||
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 | 105.04K | JIT | All errors | 8 μs | 12.74x | ||
sury (safe) | Code snippet | 11.0.0-alpha.4 | 105.04K | JIT | All errors | 8 μs | 13.08x | |||
effect | Code snippet(Commented code is not benchmarked) | 3.21.0 | 8.47M | None | Abort early | 9 μs | 14.24x | |||
superstruct | Code snippet | 2.0.2 | 3.61M | None | Abort early | 10 μs | 15.81x | |||
superstruct (schema.validate) | Code snippet | 2.0.2 | 3.61M | None | Abort early | 11 μs | 16.26x | |||
effect@beta | Code snippet(Commented code is not benchmarked) | 4.0.0-beta.43 | 8.47M | None | All errors | 21 μs | 31.68x | |||
valibot (abortPipeEarly only) | Code snippet | 1.3.1 | 6.74M | None | Abort early | 28 μs | 43.49x | |||
valibot | Code snippet | 1.3.1 | 6.74M | None | All errors | 28 μs | 43.78x | |||
effect | Code snippet(Commented code is not benchmarked) | 3.21.0 | 8.47M | None | All errors | 31 μs | 47.36x | |||
@railway-ts/pipelines | Code snippet | 0.1.27 | 64 | None | All errors | 31 μs | 47.39x | |||
zod/v3 | Code snippet | 4.3.6 | 132.2M | None | All errors | 39 μs | 60.58x | |||
joi | Code snippet | 18.1.2 | 16.45M | None | All errors | 62 μs | 95.14x | |||
decoders | Code snippet | 2.9.2 | 41.42K | None | All errors | 65 μs | 100.61x | |||
zod/mini (jitless) | Code snippet | 4.3.6 | 132.2M | None | All errors | 71 μs | 109.52x | |||
zod/mini | Code snippet | 4.3.6 | 132.2M | JIT | All errors | 71 μs | 110.25x | |||
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.18 | 229.4K | JIT | All errors | 76 μs | 117.26x | ||
superstruct | Code snippet | 2.0.2 | 3.61M | None | All errors | 79 μs | 122.22x | |||
superstruct | Code snippet | 2.0.2 | 3.61M | None | All errors | 79 μs | 122.46x | |||
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.18 | 229.4K | JIT | All errors | 80 μs | 123.54x | ||
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.18 | 229.4K | JIT | All errors | 84 μs | 130.12x | ||
zod | Code snippet | 4.3.6 | 132.2M | JIT | All errors | 90 μs | 138.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.18 | 229.4K | JIT | All errors | 90 μs | 139.39x | ||
zod (jitless) | Code snippet | 4.3.6 | 132.2M | None | All errors | 93 μs | 143.8x | |||
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.44M | None | Abort early | 96 μs | 147.55x | ||
arktype | Code snippet | 2.2.0 | 848.08K | JIT | All errors | 98 μs | 152.02x | |||
runtypes | Code snippet | 7.0.4 | 247.26K | None | Abort early | 191 μs | 294.06x | |||
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 | 247.26K | None | Abort early | 206 μs | 317.38x | ||
@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 | 628.65K | None | All errors | 272 μs | 419.66x | ||
@sapphire/shapeshift (run) | Code snippet | 4.0.0 | 628.65K | None | All errors | 276 μs | 425.47x | |||
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.44M | None | All errors | 536 μs | 827.25x | ||