Logo

Schema Benchmarks

Collapse
    • homeHome

    • timerInitialization
    • check_circleValidation
    • output_circleParsing

    • download_2Download
Expand sidebar
Benchmarkschevron_rightValidation

Checking if a given value matches the schema. This is different to parsing because it doesn't return a new value.

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

if (v.is(personSchema, data)) {
  // data is narrowed to Person
}
Data
check_circleValiderrorInvalid
Optimizations
flash_offNonecodeJITbuildPrecompiled
LibraryVersionOptimizationsMeanCompare
typebox (compile)
Code snippet
// const compiled = Compile(schema);
compiled.Check(data);

(Commented code is not benchmarked)

1.0.51JIT50 ns
ajv (compile)
Code snippet
// const validate = ajv.compile(schema);
validate(data);

(Commented code is not benchmarked)

8.17.1JIT3 μs
67.96x
stat_minus_3
ajv (validate)
Code snippet
ajv.validate(schema, data)
8.17.1JIT3 μs
68.74x
stat_minus_3
Created by eskimojo for Open Circle