LogoLogo

Schema Benchmarks

    • home
      Home

    • download_2
      Download

    • timer
      Initialization
    • check_circle
      Validation
    • output_circle
      Parsing
    • swap_horiz
      Codec
    • schema
      Standard Schema
    • format_quote
      String

    • error
      Stack

    • article
      Blog
Code styleCode style
Normal styleNormal style
System themeSystem theme
Light themeLight theme
Dark themeDark theme
Expand sidebarExpand sidebar
Benchmarks/ValidationValidation
Code styleCode style
Normal styleNormal style
System themeSystem theme
Light themeLight theme
Dark themeDark theme
github
GitHubGitHub
DiscordDiscord

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

Copy to clipboardCopy to clipboard
import * as v from "valibot"; import { personSchema } from "./schemas"; if (v.is(personSchema, data)) { // data is narrowed to Person }
Data
errorInvalidcheck_circleValid
Optimizations
flash_offNonecodeJITbuildPrecompiled
LibrarysortVersionDownloads (/wk)sortOptimizationsMeanarrow_upwardCompare
ata-validator
Code snippetCode snippet
schema.isValidObject(data)
0.8.0728JIT51 ns
typebox (schema compile)
Code snippetCode snippet
// const compiledSchema = Schema.Compile(schema);
compiledSchema.Check(data);

(Commented code is not benchmarked)

1.1.23277.92KJIT65 ns
1.29x
stat_minus_1
typebox (compile)
Code snippetCode snippet
// const compiled = Compile(schema);
compiled.Check(data);

(Commented code is not benchmarked)

1.1.23277.92KJIT65 ns
1.29x
stat_minus_1
ajv (compile)
Code snippetCode snippet
// const validate = ajv.compile(schema);
validate(data);

(Commented code is not benchmarked)

8.18.0259.98MJIT87 ns
1.7x
stat_minus_1
ajv (validate)
Code snippetCode snippet
ajv.validate(schema, data)
8.18.0259.98MJIT136 ns
2.68x
stat_minus_1
arktype
Code snippetCode snippet
schema.allows(data)
2.2.0885.45KJIT679 ns
13.38x
stat_minus_1
typebox
Code snippetCode snippet
Value.Check(schema, data)
1.1.23277.92KJIT4 μs
83.4x
stat_minus_3
typebox (schema)
Code snippetCode snippet
Schema.Check(schema, data)
1.1.23277.92KJIT5 μs
90.11x
stat_minus_3
Created by eskimojo for Open Circle