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 | ||||
|---|---|---|---|---|---|---|---|---|---|---|
zod | Code snippet | 4.4.1 | 163.46M | JIT | All errors | 76 μs | ||||
zod (jitless) | Code snippet | 4.4.1 | 163.46M | None | All errors | 81 μs | 1.05x | |||
zod/mini | Code snippet | 4.4.1 | 163.46M | JIT | All errors | 66 μs | 1.15x | |||
zod/mini (jitless) | Code snippet | 4.4.1 | 163.46M | None | All errors | 66 μs | 1.16x | |||
zod/v3 | Code snippet | 4.4.1 | 163.46M | None | All errors | 40 μs | 1.93x | |||
joi | Code snippet | 18.1.2 | 19.41M | None | Abort early | 4 μs | 18.84x | |||
joi | Code snippet | 18.1.2 | 19.41M | None | All errors | 63 μs | 1.22x | |||
effect | Code snippet | 3.21.2 | 12.89M | None | Abort early | 9 μs | 8.15x | |||
effect | Code snippet | 3.21.2 | 12.89M | None | All errors | 32 μs | 2.41x | |||
effect@beta | Code snippet | 4.0.0-beta.59 | 12.89M | None | Abort early | 1 μs | 67.98x | |||
effect@beta | Code snippet | 4.0.0-beta.59 | 12.89M | None | All errors | 20 μs | 3.87x | |||
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 | 1.26x | ||
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 | 7.01x | ||
valibot | Code snippet | 1.3.1 | 9.37M | None | Abort early | 757 ns | 100.95x | |||
valibot | Code snippet | 1.3.1 | 9.37M | None | All errors | 28 μs | 2.68x | |||
valibot (abortPipeEarly only) | Code snippet | 1.3.1 | 9.37M | None | Abort early | 28 μs | 2.7x | |||
superstruct | Code snippet | 2.0.2 | 4.49M | None | Abort early | 10 μs | 7.55x | |||
superstruct | Code snippet | 2.0.2 | 4.49M | None | All errors | 82 μs | 1.07x | |||
superstruct | Code snippet | 2.0.2 | 4.49M | None | All errors | 84 μs | 1.1x | |||
superstruct (schema.validate) | Code snippet | 2.0.2 | 4.49M | None | Abort early | 10 μs | 7.35x | |||
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 | 1.28x | ||
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 | 1.17x | ||
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 | 1.05x | ||
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 | 1.11x | ||
io-ts | Code snippet | 2.2.22 | 3M | None | All errors | 6 μs | 12.91x | |||
arktype | Code snippet | 2.2.0 | 833.25K | JIT | All errors | 98 μs | 1.28x | |||
@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 | 3.56x | ||
@sapphire/shapeshift (run) | Code snippet | 4.0.0 | 812.32K | None | All errors | 273 μs | 3.57x | |||
runtypes | Code snippet | 7.0.4 | 306.88K | None | Abort early | 192 μs | 2.51x | |||
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.71x | ||
typia (createValidate) | Code snippet | 12.0.2 | 291.57K | Precompiled | All errors | 7 μs | 11.59x | |||
typia (validate) | Code snippet | 12.0.2 | 291.57K | Precompiled | All errors | 7 μs | 11.21x | |||
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 | 9.43x | ||
sury (compile + safe) | Code snippet | 11.0.0-alpha.4 | 180.31K | JIT | All errors | 8 μs | 9.65x | |||
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 | 9.89x | ||
sury (safe) | Code snippet | 11.0.0-alpha.4 | 180.31K | JIT | All errors | 8 μs | 9.29x | |||
decoders | Code snippet | 2.9.3 | 44.56K | None | All errors | 73 μs | 1.04x | |||
ata-validator | Code snippet | 0.12.1 | 748 | JIT | All errors | 716 ns | 106.68x | |||
@railway-ts/pipelines | Code snippet | 0.1.29 | 98 | None | Abort early | 677 ns | 112.89x | |||
@railway-ts/pipelines | Code snippet | 0.1.29 | 98 | None | All errors | 31 μs | 2.47x | |||