LogoLogo

Schema Benchmarks

    • home
      Home

    • download_2
      Download
    • timer
      Initialization
    • check_circle
      Validation
    • output_circle
      Parsing

    • 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

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
errorInvalidcheck_circleValid
Optimizations
flash_offNonecodeJITbuildPrecompiled
LibrarysortVersionDownloads (/wk)sortOptimizationsMeanarrow_upwardCompare
typia (createIs)
Code snippet
// const is = typia.createIs<TypiaSchema>();
is(data);

(Commented code is not benchmarked)

11.0.3239KPrecompiled49 ns
typebox (compile)
Code snippet
// const compiled = Compile(schema);
compiled.Check(data);

(Commented code is not benchmarked)

1.0.81165KJIT50 ns
1.01x
stat_minus_1
typia (is)
Code snippet
typia.is<TypiaSchema>(data)
11.0.3239KPrecompiled65 ns
1.32x
stat_minus_1
ajv (compile)
Code snippet
// const validate = ajv.compile(schema);
validate(data);

(Commented code is not benchmarked)

8.18.0201MJIT84 ns
1.71x
stat_minus_1
ajv (validate)
Code snippet
ajv.validate(schema, data)
8.18.0201MJIT124 ns
2.53x
stat_minus_1
effect
Code snippet
// const is = Schema.is(schema);
is(data);

(Commented code is not benchmarked)

3.19.177MNone708 ns
14.38x
stat_minus_1
valibot
Code snippet
v.is(schema, data)
1.2.05.6MNone715 ns
14.52x
stat_minus_1
arktype
Code snippet
schema.allows(data)
2.1.29681KJIT750 ns
15.24x
stat_minus_1
typebox
Code snippet
Value.Check(schema, data)
1.0.81165KNone3 μs
56.69x
stat_minus_1
joi
Code snippet
schema.validate(data)
18.0.215MNone3 μs
71.07x
stat_minus_1
yup
Code snippet
schema.isValidSync(data)
1.7.19MNone93 μs
1_891.56x
stat_minus_3
Created by eskimojo for Open Circle