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 | 143 | None | Abort early | 634 ns | ||||
valibot | Code snippet | 1.4.0 | 10.19M | None | Abort early | 715 ns | 1.13x | |||
ata-validator | Code snippet | 0.13.2 | 750 | JIT | All errors | 738 ns | 1.16x | |||
effect@beta | Code snippet(Commented code is not benchmarked) | 4.0.0-beta.65 | 13.85M | None | Abort early | 1 μs | 1.9x | |||
joi | Code snippet | 18.2.1 | 20.07M | None | Abort early | 4 μs | 6.36x | |||
io-ts | Code snippet | 2.2.22 | 3.37M | None | All errors | 6 μs | 9.43x | |||
typia (createValidate) | Code snippet(Commented code is not benchmarked) | 12.1.1 | 259.87K | Precompiled | All errors | 6 μs | 9.54x | |||
typia (validate) | Code snippet | 12.1.1 | 259.87K | Precompiled | All errors | 6 μs | 10.04x | |||
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 | 194.21K | JIT | All errors | 8 μs | 11.94x | ||
sury (compile + safe) | Code snippet(Commented code is not benchmarked) | 11.0.0-alpha.4 | 194.21K | JIT | All errors | 8 μs | 11.99x | |||
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 | 194.21K | JIT | All errors | 8 μs | 12.39x | ||
sury (safe) | Code snippet | 11.0.0-alpha.4 | 194.21K | JIT | All errors | 8 μs | 12.46x | |||
effect | Code snippet(Commented code is not benchmarked) | 3.21.2 | 13.85M | None | Abort early | 10 μs | 15.08x | |||
superstruct | Code snippet | 2.0.2 | 4.68M | None | Abort early | 10 μs | 15.43x | |||
superstruct (schema.validate) | Code snippet | 2.0.2 | 4.68M | None | Abort early | 10 μs | 15.83x | |||
effect@beta | Code snippet(Commented code is not benchmarked) | 4.0.0-beta.65 | 13.85M | None | All errors | 20 μs | 32.06x | |||
valibot (abortPipeEarly only) | Code snippet | 1.4.0 | 10.19M | None | Abort early | 27 μs | 42.08x | |||
valibot | Code snippet | 1.4.0 | 10.19M | None | All errors | 27 μs | 42.52x | |||
@railway-ts/pipelines | Code snippet | 0.1.29 | 143 | None | All errors | 29 μs | 45.24x | |||
effect | Code snippet(Commented code is not benchmarked) | 3.21.2 | 13.85M | None | All errors | 30 μs | 47.69x | |||
zod/v3 | Code snippet | 4.4.3 | 165.11M | None | All errors | 36 μs | 56.78x | |||
joi | Code snippet | 18.2.1 | 20.07M | None | All errors | 55 μs | 86.5x | |||
zod/mini (jitless) | Code snippet | 4.4.3 | 165.11M | None | All errors | 58 μs | 91x | |||
zod/mini | Code snippet | 4.4.3 | 165.11M | JIT | All errors | 58 μs | 91.77x | |||
zod | Code snippet | 4.4.3 | 165.11M | JIT | All errors | 63 μs | 99.61x | |||
decoders | Code snippet | 2.9.3 | 58.56K | None | All errors | 65 μs | 103.26x | |||
zod (jitless) | Code snippet | 4.4.3 | 165.11M | None | All errors | 69 μs | 108.12x | |||
superstruct | Code snippet | 2.0.2 | 4.68M | None | All errors | 74 μs | 115.98x | |||
superstruct | Code snippet | 2.0.2 | 4.68M | None | All errors | 74 μs | 116.47x | |||
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.38 | 1.75M | JIT | All errors | 80 μs | 125.96x | ||
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 | 11.07M | None | Abort early | 83 μs | 130.48x | ||
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.38 | 1.75M | JIT | All errors | 85 μs | 134.08x | ||
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.38 | 1.75M | JIT | All errors | 87 μs | 137.76x | ||
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.1.38 | 1.75M | JIT | All errors | 90 μs | 141.33x | ||
arktype | Code snippet | 2.2.0 | 896.39K | JIT | All errors | 91 μs | 142.81x | |||
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.38 | 1.75M | JIT | All errors | 94 μs | 148.04x | ||
runtypes | Code snippet | 7.0.4 | 310.48K | None | Abort early | 170 μs | 268.46x | |||
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 | 310.48K | None | Abort early | 182 μs | 286.51x | ||
@sapphire/shapeshift (run) | Code snippet | 4.0.0 | 846.87K | None | All errors | 262 μs | 413.15x | |||
@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 | 846.87K | None | All errors | 268 μs | 422.53x | ||
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 | 11.07M | None | All errors | 484 μs | 763.28x | ||