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
    • assignment_turned_in
      TypeScript

  • JSON Schema

    • data_object
      Schema to JSON
    • code
      JSON to Schema
    • verified
      Compliance

    • deployed_code
      Libraries

    • article
      Blog
Expand sidebarExpand sidebar
Benchmarks/ParsingParsing
github
GitHubGitHub
DiscordDiscord
PreferencesPreferences

Parsing a value to match the schema. This is different to validation because it returns a typed value, instead of a boolean.

Copy to clipboardCopy to clipboard
import * as v from "valibot"; import { personSchema } from "./schemas"; const person = v.parse( personSchema, data, ); // person is of type Person
Copy to clipboardCopy to clipboard
import * as v from "valibot"; import { personSchema } from "./schemas"; const person = v.parse(personSchema, data); // person is of type Person
Data
  • errorInvalid
  • check_circleValid
Optimizations
  • flash_offNone
  • codeJIT
  • buildPrecompiled
Abort early
  • errorAll errors
  • warningAbort early
LibrarysortVersiondownload/wkarrow_upwardOptimizationsError typeMeansortCompare
effect
Code snippetCode snippet
const decode = Schema.decodeUnknownOption(schema);
decode(data, { errors: "first" })

(Setup code is not benchmarked)

4.1.266.82MNoneAbort early882 ns
joi
Code snippetCode snippet
schema.validate(data, { abortEarly: true })
18.3.234.47MNoneAbort early4 μs
4.48x
stat_minus_1
joi (no convert)
Code snippetCode snippet
schema.validate(data, { abortEarly: true, convert: false })
18.3.234.47MNoneAbort early4 μs
4.32x
stat_minus_1
valibot
Code snippetCode snippet
v.safeParse(schema, data, { abortEarly: true })
1.5.032.05MNoneAbort early615 ns
1.43x
stat_1
valibot (abortPipeEarly only)
Code snippetCode snippet
v.safeParse(schema, data, { abortPipeEarly: true })
1.5.032.05MNoneAbort early11 μs
12.54x
stat_minus_1
yup
Code snippetCode snippet
schema.validateSync(data, { abortEarly: true })
Throws on invalid dataThrows on invalid data
This library throws an error when parsing invalid data (and has no non-throwing equivalent), so the benchmark includes a try/catch.
1.7.116.36MNoneAbort early86 μs
97.06x
stat_minus_2
yup (strict)
Code snippetCode snippet
schema.validateSync(data, { abortEarly: true, strict: true })
Throws on invalid dataThrows on invalid data
This library throws an error when parsing invalid data (and has no non-throwing equivalent), so the benchmark includes a try/catch.
1.7.116.36MNoneAbort early58 μs
65.51x
stat_minus_1
superstruct
Code snippetCode snippet
validate(data, schema)
2.0.29.59MNoneAbort early7 μs
7.59x
stat_minus_1
superstruct (schema.validate)
Code snippetCode snippet
schema.validate(data)
2.0.29.59MNoneAbort early7 μs
7.68x
stat_minus_1
runtypes
Code snippetCode snippet
schema.parse(data)
Throws on invalid dataThrows on invalid data
This library throws an error when parsing invalid data (and has no non-throwing equivalent), so the benchmark includes a try/catch.
7.0.5281.67KNoneAbort early204 μs
230.91x
stat_minus_3
runtypes (inspect)
Code snippetCode snippet
schema.inspect(data)
7.0.5281.67KNoneAbort early183 μs
207.89x
stat_minus_3
@remix-run/data-schema
Code snippetCode snippet
parseSafe(schema, data, { abortEarly: true })
1.0.051.96KNoneAbort early398 ns
2.22x
stat_1
@railway-ts/pipelines
Code snippetCode snippet
validate(data, schema, { abortEarly: true })
0.1.2959NoneAbort early672 ns
1.31x
stat_1
Created by eskimojo for Open Circle

Preferences

Style
Theme
NPM browser
Code ligatures