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 | ||||
|---|---|---|---|---|---|---|---|---|---|---|
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.89M | None | All errors | 536 μs | |||
@sapphire/shapeshift (run) | Code snippet | 4.0.0 | 812.32K | None | All errors | 273 μs | 1.96x | |||
@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 | 812.32K | None | All errors | 272 μs | 1.97x | ||
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 | 306.88K | None | Abort early | 207 μs | 2.59x | ||
runtypes | Code snippet | 7.0.4 | 306.88K | None | Abort early | 192 μs | 2.79x | |||
arktype | Code snippet | 2.2.0 | 833.25K | JIT | All errors | 98 μs | 5.46x | |||
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.34 | 3.74M | JIT | All errors | 98 μs | 5.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 | 10.89M | None | Abort early | 97 μs | 5.55x | ||
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.34 | 3.74M | JIT | All errors | 90 μs | 5.98x | ||
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.34 | 3.74M | JIT | All errors | 85 μs | 6.32x | ||
superstruct | Code snippet | 2.0.2 | 4.49M | None | All errors | 84 μs | 6.4x | |||
superstruct | Code snippet | 2.0.2 | 4.49M | None | All errors | 82 μs | 6.56x | |||
zod (jitless) | Code snippet | 4.4.1 | 163.46M | None | All errors | 81 μs | 6.65x | |||
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.34 | 3.74M | JIT | All errors | 80 μs | 6.69x | ||
zod | Code snippet | 4.4.1 | 163.46M | JIT | All errors | 76 μs | 7.01x | |||
decoders | Code snippet | 2.9.3 | 44.56K | None | All errors | 73 μs | 7.31x | |||
zod/mini | Code snippet | 4.4.1 | 163.46M | JIT | All errors | 66 μs | 8.08x | |||
zod/mini (jitless) | Code snippet | 4.4.1 | 163.46M | None | All errors | 66 μs | 8.12x | |||
joi | Code snippet | 18.1.2 | 19.41M | None | All errors | 63 μs | 8.56x | |||
zod/v3 | Code snippet | 4.4.1 | 163.46M | None | All errors | 40 μs | 13.54x | |||
effect | Code snippet | 3.21.2 | 12.89M | None | All errors | 32 μs | 16.88x | |||
@railway-ts/pipelines | Code snippet | 0.1.29 | 98 | None | All errors | 31 μs | 17.35x | |||
valibot | Code snippet | 1.3.1 | 9.37M | None | All errors | 28 μs | 18.81x | |||
valibot (abortPipeEarly only) | Code snippet | 1.3.1 | 9.37M | None | Abort early | 28 μs | 18.92x | |||
effect@beta | Code snippet | 4.0.0-beta.59 | 12.89M | None | All errors | 20 μs | 27.17x | |||
superstruct (schema.validate) | Code snippet | 2.0.2 | 4.49M | None | Abort early | 10 μs | 51.57x | |||
superstruct | Code snippet | 2.0.2 | 4.49M | None | Abort early | 10 μs | 52.97x | |||
effect | Code snippet | 3.21.2 | 12.89M | None | Abort early | 9 μs | 57.14x | |||
sury (safe) | Code snippet | 11.0.0-alpha.4 | 180.31K | JIT | All errors | 8 μs | 65.13x | |||
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 | 180.31K | JIT | All errors | 8 μs | 66.17x | ||
sury (compile + safe) | Code snippet | 11.0.0-alpha.4 | 180.31K | JIT | All errors | 8 μs | 67.67x | |||
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 | 180.31K | JIT | All errors | 8 μs | 69.33x | ||
typia (validate) | Code snippet | 12.0.2 | 291.57K | Precompiled | All errors | 7 μs | 78.61x | |||
typia (createValidate) | Code snippet | 12.0.2 | 291.57K | Precompiled | All errors | 7 μs | 81.29x | |||
io-ts | Code snippet | 2.2.22 | 3M | None | All errors | 6 μs | 90.53x | |||
joi | Code snippet | 18.1.2 | 19.41M | None | Abort early | 4 μs | 132.16x | |||
effect@beta | Code snippet | 4.0.0-beta.59 | 12.89M | None | Abort early | 1 μs | 476.75x | |||
valibot | Code snippet | 1.3.1 | 9.37M | None | Abort early | 757 ns | 707.97x | |||
ata-validator | Code snippet | 0.12.1 | 748 | JIT | All errors | 716 ns | 748.2x | |||
@railway-ts/pipelines | Code snippet | 0.1.29 | 98 | None | Abort early | 677 ns | 791.7x | |||