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

  • 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
Data
  • errorInvalid
  • check_circleValid
Optimizations
  • flash_offNone
  • codeJIT
  • buildPrecompiled
Abort early
  • errorAll errors
  • warningAbort early
LibrarysortVersiondownload/wksortOptimizationsError typeMeanarrow_upwardCompare
@railway-ts/pipelines
Code snippetCode snippet
validate(data, schema, { abortEarly: true })
0.1.29265NoneAbort early602 ns
ata-validator
Code snippetCode snippet
schema.validate(data)
1.6.21.78KJITAll errors627 ns
1.04x
stat_minus_1
valibot
Code snippetCode snippet
v.safeParse(schema, data, { abortEarly: true })
1.4.217.67MNoneAbort early690 ns
1.15x
stat_minus_1
effect@beta
Code snippetCode snippet
// const decode = Schema.decodeUnknownOption(schema);
decode(data, { errors: "first" })

(Commented code is not benchmarked)

4.0.0-beta.10130.12MNoneAbort early1 μs
2.24x
stat_minus_1
@paseri/compiler (safeParse)
Code snippetCode snippet
schema.safeParse(data)
0.7.7153PrecompiledAll errors1 μs
2.36x
stat_minus_1
@paseri/paseri (safeParse)
Code snippetCode snippet
p.object(...).safeParse(data)
1.9.7151NoneAll errors4 μs
6.24x
stat_minus_1
joi (no convert)
Code snippetCode snippet
schema.validate(data, { abortEarly: true, convert: false })
18.2.524.98MNoneAbort early4 μs
6.42x
stat_minus_1
joi
Code snippetCode snippet
schema.validate(data, { abortEarly: true })
18.2.524.98MNoneAbort early4 μs
6.75x
stat_minus_1
io-ts
Code snippetCode snippet
schema.decode(data)
2.2.222.71MNoneAll errors5 μs
8.67x
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.7153PrecompiledAll errors8 μs
13.61x
stat_minus_1
sury
Code snippetCode snippet
// const parser = S.parser(S.schema(...));
parser(data);

(Commented 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.0-rc.1305.51KJITAll errors9 μs
14.25x
stat_minus_1
sury (safe)
Code snippetCode snippet
S.safe(() => parser(data))
11.0.0-rc.1305.51KJITAll errors9 μs
14.4x
stat_minus_1
effect
Code snippetCode snippet
// const decodeFirst = Schema.decodeUnknownEither(
//  schema, 
//  { errors: "first" }
// );
decodeFirst(data)

(Commented code is not benchmarked)

3.22.030.12MNoneAbort early10 μs
17.01x
stat_minus_1
superstruct
Code snippetCode snippet
validate(data, schema)
2.0.26.03MNoneAbort early11 μs
17.8x
stat_minus_1
@paseri/paseri (parse)
Code snippetCode snippet
p.object(...).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.7151NoneAll errors11 μs
17.84x
stat_minus_1
superstruct (schema.validate)
Code snippetCode snippet
schema.validate(data)
2.0.26.03MNoneAbort early11 μs
18.38x
stat_minus_1
zod-compiler (compact)
Code snippetCode snippet
compactSchema.safeParse(data)
1.27.068.22KPrecompiledAll errors12 μs
20.72x
stat_minus_1
zod-compiler
Code snippetCode snippet
schema.safeParse(data)
1.27.068.22KPrecompiledAll errors15 μs
25.75x
stat_minus_1
zod-compiler (bag)
Code snippetCode snippet
bagSchema.safeParse(data)
1.27.068.22KPrecompiledAll errors16 μs
26.83x
stat_minus_1
typia (createValidate)
Code snippetCode snippet
// const validate = typia.createValidate<TypiaSchema>();
validate(data);

(Commented code is not benchmarked)

14.0.0329.74KPrecompiledAll errors17 μs
27.46x
stat_minus_1
typia (validate)
Code snippetCode snippet
typia.validate<TypiaSchema>(data)
14.0.0329.74KPrecompiledAll errors18 μs
29.16x
stat_minus_1
effect@beta
Code snippetCode snippet
// const decode = Schema.decodeUnknownOption(schema);
decode(data, { errors: "all" })

(Commented code is not benchmarked)

4.0.0-beta.10130.12MNoneAll errors21 μs
34.89x
stat_minus_1
valibot (abortPipeEarly only)
Code snippetCode snippet
v.safeParse(schema, data, { abortPipeEarly: true })
1.4.217.67MNoneAbort early28 μs
46x
stat_minus_1
valibot
Code snippetCode snippet
v.safeParse(schema, data)
1.4.217.67MNoneAll errors28 μs
46.49x
stat_minus_1
effect
Code snippetCode snippet
// const decodeAll = Schema.decodeUnknownEither(
//  schema, 
//  { errors: "all" }
// );
decodeAll(data)

(Commented code is not benchmarked)

3.22.030.12MNoneAll errors29 μs
47.91x
stat_minus_1
@railway-ts/pipelines
Code snippetCode snippet
validate(data, schema)
0.1.29265NoneAll errors30 μs
50.39x
stat_minus_1
zod/v3
Code snippetCode snippet
schema.safeParse(data)
4.4.3265.74MNoneAll errors39 μs
64.38x
stat_minus_1
joi (no convert)
Code snippetCode snippet
schema.validate(data, { abortEarly: false, convert: false })
18.2.524.98MNoneAll errors51 μs
85.19x
stat_minus_1
joi
Code snippetCode snippet
schema.validate(data, { abortEarly: false })
18.2.524.98MNoneAll errors57 μs
93.95x
stat_minus_1
zod/mini
Code snippetCode snippet
schema.safeParse(data)
4.4.3265.74MJITAll errors59 μs
97.63x
stat_minus_1
zod/mini (jitless)
Code snippetCode snippet
schema.safeParse(data, { jitless: true })
4.4.3265.74MNoneAll errors59 μs
97.97x
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.112.55MNoneAbort early63 μs
105.26x
stat_minus_1
zod
Code snippetCode snippet
schema.safeParse(data)
4.4.3265.74MJITAll errors64 μs
107.17x
stat_minus_1
decoders
Code snippetCode snippet
schema.decode(data)
2.9.328.35KNoneAll errors65 μs
107.77x
stat_minus_1
superstruct
Code snippetCode snippet
const [error] = validate(data, schema);
for (const failure of error.failures()) {
  // ...
}
2.0.26.03MNoneAll errors71 μs
118.37x
stat_minus_1
zod (jitless)
Code snippetCode snippet
schema.safeParse(data, { jitless: true })
4.4.3265.74MNoneAll errors71 μs
118.71x
stat_minus_1
superstruct
Code snippetCode snippet
const [error] = schema.validate(data);
for (const failure of error.failures()) {
  // ...
}
2.0.26.03MNoneAll errors73 μs
121.48x
stat_minus_1
typebox (schema compile)
Code snippetCode snippet
// const compiledSchema = Schema.Compile(schema);
compiledSchema.Parse(data);

(Commented 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.168.39MJITAll errors83 μs
137.91x
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.168.39MJITAll errors87 μs
145.19x
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.112.55MNoneAbort early88 μs
146.18x
stat_minus_1
arktype
Code snippetCode snippet
schema(data)
2.2.31.7MJITAll errors89 μs
147.19x
stat_minus_1
typebox (compile)
Code snippetCode snippet
// const compiled = Compile(schema);
compiled.Parse(data);

(Commented 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.168.39MJITAll errors92 μs
152.3x
stat_minus_1
typebox (script compile)
Code snippetCode snippet
// const compiledScriptSchema = Schema.Compile(scriptSchema);
compiledScriptSchema.Parse(data);

(Commented 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.168.39MJITAll errors93 μs
154.23x
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.168.39MJITAll errors97 μs
160.82x
stat_minus_1
runtypes
Code snippetCode snippet
schema.inspect(data)
7.0.5224.75KNoneAbort early163 μs
270.37x
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.5224.75KNoneAbort early173 μs
288.03x
stat_minus_1
@sapphire/shapeshift (run)
Code snippetCode snippet
schema.run(data)
5.0.01.24MNoneAll errors307 μs
510.29x
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.01.24MNoneAll errors307 μs
510.81x
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.112.55MNoneAll errors558 μs
927.11x
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.112.55MNoneAll errors586 μs
973.2x
stat_minus_3
Created by eskimojo for Open Circle

Preferences

Style
Theme
NPM browser
Code ligatures