Logo

Schema Benchmarks

Collapse
    • homeHome

    • timerInitialization
    • check_circleValidation
    • output_circleParsing

    • download_2Download
Expand sidebar
Benchmarkschevron_rightParsing

Parsing a value to match the schema. This is different to validation because it returns a new value.

import * as v from "valibot";
import { personSchema } from "./schemas";

const person = v.parse(personSchema, data);
// person is of type Person
Data
check_circleValiderrorInvalid
Optimizations
flash_offNonecodeJITbuildPrecompiled
Abort early
errorAll errorswarningAbort early
LibraryVersionOptimizationsError typeMeanCompare
typia (createValidate)
Code snippet
// const validate = typia.createValidate<TypiaSchema>();
validate(data);

(Commented code is not benchmarked)

10.0.2PrecompiledAll errors1 μs
typia (validate)
Code snippet
typia.validate<TypiaSchema>(data)
10.0.2PrecompiledAll errors1 μs
1.05x
stat_minus_1
arktype
Code snippet
schema(data)
2.1.25NoneAll errors7 μs
6.63x
stat_minus_1
zod
Code snippet
schema.safeParse(data)
4.1.12JITAll errors9 μs
7.87x
stat_minus_1
zod (mini, jitless)
Code snippet
schema.safeParse(data, { jitless: true })
4.1.12NoneAll errors11 μs
10.08x
stat_minus_1
zod (mini)
Code snippet
schema.safeParse(data)
4.1.12JITAll errors12 μs
10.59x
stat_minus_1
zod (jitless)
Code snippet
schema.safeParse(data, { jitless: true })
4.1.12NoneAll errors12 μs
10.62x
stat_minus_1
valibot
Code snippet
v.safeParse(schema, data)
1.1.0NoneAll errors12 μs
11.35x
stat_minus_1
effect
Code snippet
// const decodeAll = Schema.decodeUnknownEither(
//  schema, 
//  { errors: "all" }
// );
decodeAll(data)

(Commented code is not benchmarked)

3.19.3NoneAll errors18 μs
16.78x
stat_minus_1
joi
Code snippet
schema.validate(data, { abortEarly: false })
18.0.1NoneAll errors36 μs
33.13x
stat_minus_1
yup
Code snippet
schema.validateSync(data, { abortEarly: false })
1.7.1NoneAll errors143 μs
130.78x
stat_minus_2
typebox (compile)
Code snippet
// const compiled = Compile(schema);
compiled.Parse(data);

(Commented code is not benchmarked)

1.0.51JITAll errors249 μs
227.43x
stat_minus_3
typebox
Code snippet
Value.Parse(schema, data)
1.0.51NoneAll errors261 μs
238.72x
stat_minus_3
Created by eskimojo for Open Circle