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 | 98 | None | Abort early | 677 ns | ||||
@railway-ts/pipelines | Code snippet | 0.1.29 | 98 | None | All errors | 31 μs | 45.64x | |||
@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 | 401.38x | ||
@sapphire/shapeshift (run) | Code snippet | 4.0.0 | 812.32K | None | All errors | 273 μs | 403.18x | |||
arktype | Code snippet | 2.2.0 | 833.25K | JIT | All errors | 98 μs | 144.87x | |||
ata-validator | Code snippet | 0.12.1 | 748 | JIT | All errors | 716 ns | 1.06x | |||
decoders | Code snippet | 2.9.3 | 44.56K | None | All errors | 73 μs | 108.25x | |||
effect | Code snippet | 3.21.2 | 12.89M | None | Abort early | 9 μs | 13.85x | |||
effect | Code snippet | 3.21.2 | 12.89M | None | All errors | 32 μs | 46.9x | |||
effect@beta | Code snippet | 4.0.0-beta.59 | 12.89M | None | Abort early | 1 μs | 1.66x | |||
effect@beta | Code snippet | 4.0.0-beta.59 | 12.89M | None | All errors | 20 μs | 29.13x | |||
io-ts | Code snippet | 2.2.22 | 3M | None | All errors | 6 μs | 8.74x | |||
joi | Code snippet | 18.1.2 | 19.41M | None | Abort early | 4 μs | 5.99x | |||
joi | Code snippet | 18.1.2 | 19.41M | None | All errors | 63 μs | 92.52x | |||
runtypes | Code snippet | 7.0.4 | 306.88K | None | Abort early | 192 μs | 283.6x | |||
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 | 306.11x | ||
superstruct | Code snippet | 2.0.2 | 4.49M | None | Abort early | 10 μs | 14.94x | |||
superstruct | Code snippet | 2.0.2 | 4.49M | None | All errors | 82 μs | 120.77x | |||
superstruct | Code snippet | 2.0.2 | 4.49M | None | All errors | 84 μs | 123.69x | |||
superstruct (schema.validate) | Code snippet | 2.0.2 | 4.49M | None | Abort early | 10 μs | 15.35x | |||
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 | 11.96x | ||
sury (compile + safe) | Code snippet | 11.0.0-alpha.4 | 180.31K | JIT | All errors | 8 μs | 11.7x | |||
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 | 11.42x | ||
sury (safe) | Code snippet | 11.0.0-alpha.4 | 180.31K | JIT | All errors | 8 μs | 12.16x | |||
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 | 144.68x | ||
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 | 132.37x | ||
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 | 118.37x | ||
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 | 125.35x | ||
typia (createValidate) | Code snippet | 12.0.2 | 291.57K | Precompiled | All errors | 7 μs | 9.74x | |||
typia (validate) | Code snippet | 12.0.2 | 291.57K | Precompiled | All errors | 7 μs | 10.07x | |||
valibot | Code snippet | 1.3.1 | 9.37M | None | Abort early | 757 ns | 1.12x | |||
valibot | Code snippet | 1.3.1 | 9.37M | None | All errors | 28 μs | 42.08x | |||
valibot (abortPipeEarly only) | Code snippet | 1.3.1 | 9.37M | None | Abort early | 28 μs | 41.84x | |||
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 | 142.74x | ||
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 | 791.7x | ||
zod | Code snippet | 4.4.1 | 163.46M | JIT | All errors | 76 μs | 112.89x | |||
zod (jitless) | Code snippet | 4.4.1 | 163.46M | None | All errors | 81 μs | 119.04x | |||
zod/mini | Code snippet | 4.4.1 | 163.46M | JIT | All errors | 66 μs | 98.02x | |||
zod/mini (jitless) | Code snippet | 4.4.1 | 163.46M | None | All errors | 66 μs | 97.5x | |||
zod/v3 | Code snippet | 4.4.1 | 163.46M | None | All errors | 40 μs | 58.49x | |||