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.45.08.29KJITAll errors46 ns
zod-compiler
Code snippetCode snippet
schema.safeParse(data)
2.0.798.82KPrecompiledAll errors48 ns
1.04x
stat_minus_1
zod-compiler (compact)
Code snippetCode snippet
compactSchema.safeParse(data)
2.0.798.82KPrecompiledAll errors48 ns
1.04x
stat_minus_1
zod-compiler (bag)
Code snippetCode snippet
bagSchema.safeParse(data)
2.0.798.82KPrecompiledAll errors48 ns
1.05x
stat_minus_1
@paseri/compiler (safeParse)
Code snippetCode snippet
schema.safeParse(data)
0.7.7924PrecompiledAll errors1 μs
23.66x
stat_minus_1
@paseri/paseri (safeParse)
Code snippetCode snippet
p.object(shape).safeParse(data)
1.9.7932NoneAll errors3 μs
63.63x
stat_minus_1
sury (asResult)
Code snippetCode snippet
const parseAsResult = S.parseAsResult(S.schema(value));
parseAsResult(data);

(Setup code is not benchmarked)

11.0.0538.18KJITAll errors3 μs
72.4x
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.0.0538.18KJITAll errors3 μs
74.84x
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.7924PrecompiledAll errors4 μs
79.05x
stat_minus_1
io-ts
Code snippetCode snippet
schema.decode(data)
2.2.223.67MNoneAll errors4 μs
95.8x
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.7932NoneAll errors6 μs
121.99x
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.3.3615.54MJITAll errors7 μs
156.2x
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.3.3615.54MJITAll errors7 μs
158.45x
stat_minus_1
valibot
Code snippetCode snippet
v.safeParse(schema, data)
1.5.025.54MNoneAll errors9 μs
186.48x
stat_minus_1
@remix-run/data-schema
Code snippetCode snippet
parseSafe(schema, data)
1.0.014.55KNoneAll errors10 μs
208.17x
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.3.3615.54MJITAll errors10 μs
211.45x
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.3.3615.54MJITAll errors10 μs
216.79x
stat_minus_1
zod
Code snippetCode snippet
schema.safeParse(data)
4.6.5387.37MJITAll errors10 μs
218.03x
stat_minus_1
zod (compile)
Code snippetCode snippet
compiledSchema.safeParse(data)
4.6.5387.37MJITAll errors10 μs
229.72x
stat_minus_1
typia (createValidate)
Code snippetCode snippet
const validate = typia.createValidate<TypiaSchema>();
validate(data);

(Setup code is not benchmarked)

15.1.0394.3KPrecompiledAll errors11 μs
237.36x
stat_minus_1
effect
Code snippetCode snippet
const decode = Schema.decodeUnknownOption(schema);
decode(data, { errors: "all" })

(Setup code is not benchmarked)

4.0.151.26MNoneAll errors12 μs
252.22x
stat_minus_1
typia (validate)
Code snippetCode snippet
typia.validate<TypiaSchema>(data)
15.1.0394.3KPrecompiledAll errors12 μs
253.96x
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.45.08.29KJITAll errors12 μs
256.88x
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.3.3615.54MJITAll errors13 μs
286.98x
stat_minus_1
@railway-ts/pipelines
Code snippetCode snippet
validate(data, schema)
0.1.29148NoneAll errors16 μs
356.28x
stat_minus_1
zod (jitless)
Code snippetCode snippet
schema.safeParse(data, { jitless: true })
4.6.5387.37MNoneAll errors17 μs
368.48x
stat_minus_1
zod/mini
Code snippetCode snippet
schema.safeParse(data)
4.6.5387.37MJITAll errors17 μs
370.39x
stat_minus_1
zod/mini (compile)
Code snippetCode snippet
compiledSchema.safeParse(data)
4.6.5387.37MJITAll errors17 μs
370.44x
stat_minus_1
zod/mini (jitless)
Code snippetCode snippet
schema.safeParse(data, { jitless: true })
4.6.5387.37MNoneAll errors17 μs
371.02x
stat_minus_1
zod/v3
Code snippetCode snippet
schema.safeParse(data)
4.6.5387.37MNoneAll errors24 μs
528.15x
stat_minus_1
decoders
Code snippetCode snippet
schema.decode(data)
2.12.247.84KNoneAll errors32 μs
691.14x
stat_minus_1
joi (no convert)
Code snippetCode snippet
schema.validate(data, { abortEarly: false, convert: false })
18.2.931.1MNoneAll errors41 μs
897.12x
stat_minus_1
joi
Code snippetCode snippet
schema.validate(data, { abortEarly: false })
18.2.931.1MNoneAll errors43 μs
930.67x
stat_minus_1
superstruct (schema.validate)
Code snippetCode snippet
const [error] = schema.validate(data);
for (const failure of error.failures()) {
  // ...
}
2.0.27.87MNoneAll errors54 μs
1_171.77x
stat_minus_1
superstruct
Code snippetCode snippet
const [error] = validate(data, schema);
for (const failure of error.failures()) {
  // ...
}
2.0.27.87MNoneAll errors55 μs
1_196.57x
stat_minus_1
arktype
Code snippetCode snippet
schema(data)
2.2.72.55MJITAll errors70 μs
1_523.16x
stat_minus_1
@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.01.85MNoneAll errors98 μs
2_139.83x
stat_minus_2
@sapphire/shapeshift (run)
Code snippetCode snippet
schema.run(data)
5.0.01.85MNoneAll errors99 μs
2_170.15x
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.114.63MNoneAll errors247 μs
5_400.49x
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.114.63MNoneAll errors269 μs
5_881.3x
stat_minus_3
Created by eskimojo for Open Circle

Preferences

Style
Theme
NPM browser
Code ligatures