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/wksortOptimizationsError typeMeanarrow_upwardCompare
@remix-run/data-schema
Code snippetCode snippet
parseSafe(schema, data, { abortEarly: true })
1.0.054.6KNoneAbort early387 ns
valibot
Code snippetCode snippet
v.safeParse(schema, data, { abortEarly: true })
1.5.032.14MNoneAbort early594 ns
1.53x
stat_minus_1
@railway-ts/pipelines
Code snippetCode snippet
validate(data, schema, { abortEarly: true })
0.1.2975NoneAbort early681 ns
1.76x
stat_minus_1
effect
Code snippetCode snippet
const decode = Schema.decodeUnknownOption(schema);
decode(data, { errors: "first" })

(Setup code is not benchmarked)

4.1.268.36MNoneAbort early848 ns
2.19x
stat_minus_1
joi (no convert)
Code snippetCode snippet
schema.validate(data, { abortEarly: true, convert: false })
18.3.234.64MNoneAbort early4 μs
10.1x
stat_minus_1
@paseri/paseri (safeParse)
Code snippetCode snippet
p.object(shape).safeParse(data)
1.9.7520NoneAll errors4 μs
10.3x
stat_minus_1
joi
Code snippetCode snippet
schema.validate(data, { abortEarly: true })
18.3.234.64MNoneAbort early4 μs
10.5x
stat_minus_1
io-ts
Code snippetCode snippet
schema.decode(data)
2.2.223.91MNoneAll errors5 μs
13.46x
stat_minus_1
superstruct (schema.validate)
Code snippetCode snippet
schema.validate(data)
2.0.29.67MNoneAbort early7 μs
17.5x
stat_minus_1
superstruct
Code snippetCode snippet
validate(data, schema)
2.0.29.67MNoneAbort early7 μs
18.24x
stat_minus_1
@paseri/paseri (parse)
Code snippetCode snippet
p.object(shape).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.
1.9.7520NoneAll errors7 μs
19.15x
stat_minus_1
valibot (abortPipeEarly only)
Code snippetCode snippet
v.safeParse(schema, data, { abortPipeEarly: true })
1.5.032.14MNoneAbort early11 μs
27.88x
stat_minus_1
valibot
Code snippetCode snippet
v.safeParse(schema, data)
1.5.032.14MNoneAll errors11 μs
27.95x
stat_minus_1
@remix-run/data-schema
Code snippetCode snippet
parseSafe(schema, data)
1.0.054.6KNoneAll errors14 μs
37.39x
stat_minus_1
effect
Code snippetCode snippet
const decode = Schema.decodeUnknownOption(schema);
decode(data, { errors: "all" })

(Setup code is not benchmarked)

4.1.268.36MNoneAll errors15 μs
38.8x
stat_minus_1
zod/mini (jitless)
Code snippetCode snippet
schema.safeParse(data, { jitless: true })
4.6.7454.84MNoneAll errors21 μs
54.77x
stat_minus_1
@railway-ts/pipelines
Code snippetCode snippet
validate(data, schema)
0.1.2975NoneAll errors21 μs
54.83x
stat_minus_1
zod (jitless)
Code snippetCode snippet
schema.safeParse(data, { jitless: true })
4.6.7454.84MNoneAll errors21 μs
55.5x
stat_minus_1
zod/v3
Code snippetCode snippet
schema.safeParse(data)
4.6.7454.84MNoneAll errors32 μs
82.39x
stat_minus_1
decoders
Code snippetCode snippet
schema.decode(data)
2.13.093.42KNoneAll errors49 μs
126.42x
stat_minus_1
joi (no convert)
Code snippetCode snippet
schema.validate(data, { abortEarly: false, convert: false })
18.3.234.64MNoneAll errors55 μs
142.57x
stat_minus_1
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.35MNoneAbort early58 μs
149.23x
stat_minus_1
joi
Code snippetCode snippet
schema.validate(data, { abortEarly: false })
18.3.234.64MNoneAll errors59 μs
152.82x
stat_minus_1
superstruct
Code snippetCode snippet
const [error] = validate(data, schema);
for (const failure of error.failures()) {
  // ...
}
2.0.29.67MNoneAll errors71 μs
183.97x
stat_minus_1
superstruct (schema.validate)
Code snippetCode snippet
const [error] = schema.validate(data);
for (const failure of error.failures()) {
  // ...
}
2.0.29.67MNoneAll errors72 μs
185.25x
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.35MNoneAbort early84 μs
216.9x
stat_minus_1
@sapphire/shapeshift (run)
Code snippetCode snippet
schema.run(data)
5.0.02.14MNoneAll errors132 μs
341.32x
stat_minus_2
@sapphire/shapeshift
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.
5.0.02.14MNoneAll errors138 μs
355.65x
stat_minus_2
runtypes (inspect)
Code snippetCode snippet
schema.inspect(data)
7.0.5289.25KNoneAbort early179 μs
462.35x
stat_minus_2
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.5289.25KNoneAbort early199 μs
514.06x
stat_minus_2
yup (strict)
Code snippetCode snippet
schema.validateSync(data, { abortEarly: false, 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.35MNoneAll errors355 μs
916.95x
stat_minus_3
yup
Code snippetCode snippet
schema.validateSync(data, { abortEarly: false })
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.35MNoneAll errors390 μs
1_007.34x
stat_minus_3
Created by eskimojo for Open Circle

Preferences

Style
Theme
NPM browser
Code ligatures