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 | /wk | Optimizations | Error type | Mean | Compare | ||||
|---|---|---|---|---|---|---|---|---|---|---|
@railway-ts/pipelines | Code snippet | 0.1.29 | 225 | None | Abort early | 670 ns | ||||
ata-validator | Code snippet | 1.3.0 | 1.14K | JIT | All errors | 759 ns | 1.13x | |||
valibot | Code snippet | 1.4.2 | 16.52M | None | Abort early | 788 ns | 1.18x | |||
effect@beta | Code snippet(Commented code is not benchmarked) | 4.0.0-beta.101 | 26.04M | None | Abort early | 1 μs | 1.83x | |||
@paseri/compiler (safeParse) | Code snippet | 0.7.7 | 103 | Precompiled | All errors | 1 μs | 2.22x | |||
joi | Code snippet | 18.2.3 | 23.54M | None | Abort early | 4 μs | 5.99x | |||
@paseri/paseri (safeParse) | Code snippet | 1.9.7 | 93 | None | All errors | 4 μs | 6.09x | |||
io-ts | Code snippet | 2.2.22 | 2.63M | None | All errors | 6 μs | 8.67x | |||
sury | 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-rc.0 | 320.77K | JIT | All errors | 8 μs | 11.2x | ||
sury (safe) | Code snippet | 11.0.0-rc.0 | 320.77K | JIT | All errors | 8 μs | 11.23x | |||
@paseri/compiler (parse) | 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. | 0.7.7 | 103 | Precompiled | All errors | 8 μs | 11.91x | ||
effect | Code snippet(Commented code is not benchmarked) | 3.22.0 | 26.04M | None | Abort early | 9 μs | 13.97x | |||
superstruct | Code snippet | 2.0.2 | 5.44M | None | Abort early | 10 μs | 14.93x | |||
superstruct (schema.validate) | Code snippet | 2.0.2 | 5.44M | None | Abort early | 10 μs | 15.26x | |||
@paseri/paseri (parse) | 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.9.7 | 93 | None | All errors | 10 μs | 15.37x | ||
typia (createValidate) | Code snippet(Commented code is not benchmarked) | 13.2.0 | 350.5K | Precompiled | All errors | 17 μs | 25.82x | |||
typia (validate) | Code snippet | 13.2.0 | 350.5K | Precompiled | All errors | 19 μs | 27.91x | |||
effect@beta | Code snippet(Commented code is not benchmarked) | 4.0.0-beta.101 | 26.04M | None | All errors | 22 μs | 32.23x | |||
valibot (abortPipeEarly only) | Code snippet | 1.4.2 | 16.52M | None | Abort early | 30 μs | 44.08x | |||
valibot | Code snippet | 1.4.2 | 16.52M | None | All errors | 30 μs | 44.7x | |||
@railway-ts/pipelines | Code snippet | 0.1.29 | 225 | None | All errors | 31 μs | 46.58x | |||
effect | Code snippet(Commented code is not benchmarked) | 3.22.0 | 26.04M | None | All errors | 31 μs | 46.91x | |||
zod/v3 | Code snippet | 4.4.3 | 251.7M | None | All errors | 41 μs | 61.07x | |||
joi | Code snippet | 18.2.3 | 23.54M | None | All errors | 62 μs | 92.62x | |||
zod/mini (jitless) | Code snippet | 4.4.3 | 251.7M | None | All errors | 65 μs | 97.23x | |||
zod/mini | Code snippet | 4.4.3 | 251.7M | JIT | All errors | 65 μs | 97.52x | |||
decoders | Code snippet | 2.9.3 | 37.07K | None | All errors | 70 μs | 103.88x | |||
zod | Code snippet | 4.4.3 | 251.7M | JIT | All errors | 77 μs | 115.64x | |||
superstruct | Code snippet | 2.0.2 | 5.44M | None | All errors | 81 μs | 120.23x | |||
superstruct | Code snippet | 2.0.2 | 5.44M | None | All errors | 81 μs | 120.57x | |||
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.3.10 | 6.97M | JIT | All errors | 82 μs | 122.11x | ||
zod (jitless) | Code snippet | 4.4.3 | 251.7M | None | All errors | 82 μs | 122.38x | |||
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.3.10 | 6.97M | JIT | All errors | 87 μs | 129.31x | ||
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.3.10 | 6.97M | JIT | All errors | 91 μs | 135.34x | ||
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.3.10 | 6.97M | JIT | All errors | 92 μs | 137.97x | ||
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 | 12.02M | None | Abort early | 96 μs | 143.95x | ||
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.3.10 | 6.97M | JIT | All errors | 98 μs | 145.65x | ||
arktype | Code snippet | 2.2.3 | 1.36M | JIT | All errors | 99 μs | 147.51x | |||
runtypes | Code snippet | 7.0.4 | 252.38K | None | Abort early | 191 μs | 285.19x | |||
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 | 252.38K | None | Abort early | 208 μs | 310.84x | ||
@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 | 1.1M | None | All errors | 273 μs | 407.85x | ||
@sapphire/shapeshift (run) | Code snippet | 4.0.0 | 1.1M | None | All errors | 280 μs | 417.54x | |||
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 | 12.02M | None | All errors | 537 μs | 801.89x | ||