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
ata-validator
Code snippetCode snippet
schema.validate(data)
1.63.153.34KJITAll errors59 ns
zod-compiler (mini)
Code snippetCode snippet
miniSchema.safeParse(data)
2.0.8138.71KPrecompiledAll errors61 ns
1.02x
stat_minus_1
zod-compiler
Code snippetCode snippet
schema.safeParse(data)
2.0.8138.71KPrecompiledAll errors61 ns
1.02x
stat_minus_1
zod-compiler (bag + mini)
Code snippetCode snippet
bagMiniSchema.safeParse(data)
2.0.8138.71KPrecompiledAll errors61 ns
1.03x
stat_minus_1
zod-compiler (compact)
Code snippetCode snippet
compactSchema.safeParse(data)
2.0.8138.71KPrecompiledAll errors61 ns
1.03x
stat_minus_1
zod-compiler (compact + mini)
Code snippetCode snippet
compactMiniSchema.safeParse(data)
2.0.8138.71KPrecompiledAll errors61 ns
1.03x
stat_minus_1
zod-compiler (bag)
Code snippetCode snippet
bagSchema.safeParse(data)
2.0.8138.71KPrecompiledAll errors65 ns
1.11x
stat_minus_1
@paseri/compiler (safeParse)
Code snippetCode snippet
schema.safeParse(data)
0.7.7541PrecompiledAll errors1 μs
24.81x
stat_minus_1
@paseri/paseri (safeParse)
Code snippetCode snippet
p.object(shape).safeParse(data)
1.9.7520NoneAll errors4 μs
67.29x
stat_minus_1
sury (asResult)
Code snippetCode snippet
const parseAsResult = S.parseAsResult(S.schema(value));
parseAsResult(data);

(Setup code is not benchmarked)

11.1.0409.26KJITAll errors4 μs
71.37x
stat_minus_1
@paseri/compiler (parse)
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.
0.7.7541PrecompiledAll errors5 μs
79.75x
stat_minus_1
sury (parseOrThrow + compiled)
Code snippetCode snippet
const parse = S.parseOrThrow(S.schema(value));
parse(data);

(Setup code is not benchmarked)

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.
11.1.0409.26KJITAll errors5 μs
79.94x
stat_minus_1
io-ts
Code snippetCode snippet
schema.decode(data)
2.2.223.91MNoneAll errors5 μs
87.92x
stat_minus_1
ata-validator (parse)
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.
1.63.153.34KJITAll errors6 μs
95.94x
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
125.11x
stat_minus_1
typebox (script compile)
Code snippetCode snippet
const compiledScriptSchema = Schema.Compile(scriptSchema);
compiledScriptSchema.Parse(data);

(Setup code is not benchmarked)

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.4.416.33MJITAll errors9 μs
158.22x
stat_minus_1
typebox (schema compile)
Code snippetCode snippet
const compiledSchema = Schema.Compile(schema);
compiledSchema.Parse(data);

(Setup code is not benchmarked)

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.4.416.33MJITAll errors10 μs
164.54x
stat_minus_1
valibot
Code snippetCode snippet
v.safeParse(schema, data)
1.5.032.14MNoneAll errors11 μs
182.55x
stat_minus_1
typia (createValidate)
Code snippetCode snippet
const validate = typia.createValidate<TypiaSchema>();
validate(data);

(Setup code is not benchmarked)

15.2.2507.32KPrecompiledAll errors12 μs
199.56x
stat_minus_1
typia (validate)
Code snippetCode snippet
typia.validate<TypiaSchema>(data)
15.2.2507.32KPrecompiledAll errors12 μs
199.97x
stat_minus_1
zod
Code snippetCode snippet
schema.safeParse(data)
4.6.7n/aJITAll errors13 μs
211.46x
stat_minus_1
typebox (schema)
Code snippetCode snippet
Schema.Parse(schema, 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.4.416.33MJITAll errors13 μs
214.53x
stat_minus_1
typebox (compile)
Code snippetCode snippet
const compiled = Compile(schema);
compiled.Parse(data);

(Setup code is not benchmarked)

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.4.416.33MJITAll errors13 μs
220.84x
stat_minus_1
zod (compile)
Code snippetCode snippet
compiledSchema.safeParse(data)
4.6.7n/aJITAll errors14 μs
231.34x
stat_minus_1
@remix-run/data-schema
Code snippetCode snippet
parseSafe(schema, data)
1.0.0n/aNoneAll errors14 μs
244.23x
stat_minus_1
effect
Code snippetCode snippet
const decode = Schema.decodeUnknownOption(schema);
decode(data, { errors: "all" })

(Setup code is not benchmarked)

4.1.2n/aNoneAll errors15 μs
253.48x
stat_minus_1
typebox
Code snippetCode snippet
Value.Parse(schema, 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.4.416.33MJITAll errors17 μs
283.6x
stat_minus_1
zod/mini
Code snippetCode snippet
schema.safeParse(data)
4.6.7n/aJITAll errors21 μs
355.55x
stat_minus_1
zod/mini (jitless)
Code snippetCode snippet
schema.safeParse(data, { jitless: true })
4.6.7n/aNoneAll errors21 μs
357.78x
stat_minus_1
zod/mini (compile)
Code snippetCode snippet
compiledSchema.safeParse(data)
4.6.7n/aJITAll errors21 μs
358.12x
stat_minus_1
@railway-ts/pipelines
Code snippetCode snippet
validate(data, schema)
0.1.29n/aNoneAll errors21 μs
358.15x
stat_minus_1
zod (jitless)
Code snippetCode snippet
schema.safeParse(data, { jitless: true })
4.6.7n/aNoneAll errors21 μs
362.58x
stat_minus_1
zod/v3
Code snippetCode snippet
schema.safeParse(data)
4.6.7n/aNoneAll errors32 μs
538.18x
stat_minus_1
decoders
Code snippetCode snippet
schema.decode(data)
2.13.0n/aNoneAll errors49 μs
825.82x
stat_minus_1
joi (no convert)
Code snippetCode snippet
schema.validate(data, { abortEarly: false, convert: false })
18.3.2n/aNoneAll errors55 μs
931.35x
stat_minus_1
joi
Code snippetCode snippet
schema.validate(data, { abortEarly: false })
18.3.2n/aNoneAll errors59 μs
998.26x
stat_minus_1
superstruct
Code snippetCode snippet
const [error] = validate(data, schema);
for (const failure of error.failures()) {
  // ...
}
2.0.2n/aNoneAll errors71 μs
1_201.75x
stat_minus_1
superstruct (schema.validate)
Code snippetCode snippet
const [error] = schema.validate(data);
for (const failure of error.failures()) {
  // ...
}
2.0.2n/aNoneAll errors72 μs
1_210.1x
stat_minus_1
arktype
Code snippetCode snippet
schema(data)
2.2.9n/aJITAll errors101 μs
1_700.36x
stat_minus_1
@sapphire/shapeshift (run)
Code snippetCode snippet
schema.run(data)
5.0.0n/aNoneAll errors132 μs
2_229.64x
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.0n/aNoneAll errors138 μs
2_323.24x
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.1n/aNoneAll errors355 μs
5_989.93x
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.1n/aNoneAll errors390 μs
6_580.38x
stat_minus_3
Created by eskimojo for Open Circle

Preferences

Style
Theme
NPM browser
Code ligatures