Parsing a value to match the schema. This is different to validation because it returns a typed value, instead of a boolean.
Copy to clipboardimport * as v from "valibot"; import { personSchema } from "./schemas"; const person = v.parse( personSchema, data, ); // person is of type Person
Copy to clipboardimport * as v from "valibot"; import { personSchema } from "./schemas"; const person = v.parse(personSchema, data); // person is of type Person
Optimizations
Abort early
| Library | Version | /wk | Optimizations | Error type | Mean | Compare | ||||
|---|---|---|---|---|---|---|---|---|---|---|
zod-compiler (mini) | Code snippet | 2.0.8 | 138.71K | Precompiled | All errors | 61 ns | ||||
zod-compiler | Code snippet | 2.0.8 | 138.71K | Precompiled | All errors | 61 ns | 1x | |||
zod-compiler (bag + mini) | Code snippet | 2.0.8 | 138.71K | Precompiled | All errors | 61 ns | 1.01x | |||
zod-compiler (compact) | Code snippet | 2.0.8 | 138.71K | Precompiled | All errors | 61 ns | 1.01x | |||
zod-compiler (compact + mini) | Code snippet | 2.0.8 | 138.71K | Precompiled | All errors | 61 ns | 1.01x | |||
zod-compiler (bag) | Code snippet | 2.0.8 | 138.71K | Precompiled | All errors | 65 ns | 1.08x | |||
@paseri/compiler (safeParse) | Code snippet | 0.7.7 | 541 | Precompiled | All errors | 1 μs | 24.26x | |||
@paseri/compiler (parse) | Code snippet | 0.7.7 | 541 | Precompiled | All errors | 5 μs | 77.98x | |||
typia (createValidate) | Code snippet(Setup code is not benchmarked) | 15.2.2 | 507.32K | Precompiled | All errors | 12 μs | 195.15x | |||
typia (validate) | Code snippet | 15.2.2 | 507.32K | Precompiled | All errors | 12 μs | 195.55x | |||