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

    • 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 new value.

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.29225NoneAbort early670 ns
ata-validator
Code snippetCode snippet
schema.validate(data)
1.3.01.14KJITAll errors759 ns
1.13x
stat_minus_1
valibot
Code snippetCode snippet
v.safeParse(schema, data, { abortEarly: true })
1.4.216.52MNoneAbort early788 ns
1.18x
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.10126.04MNoneAbort early1 μs
1.83x
stat_minus_1
@paseri/compiler (safeParse)
Code snippetCode snippet
Product.safeParse(data)
0.7.7103PrecompiledAll errors1 μs
2.22x
stat_minus_1
joi
Code snippetCode snippet
schema.validate(data, { abortEarly: true })
18.2.323.54MNoneAbort early4 μs
5.99x
stat_minus_1
@paseri/paseri (safeParse)
Code snippetCode snippet
p.object(...).safeParse(data)
1.9.793NoneAll errors4 μs
6.09x
stat_minus_1
io-ts
Code snippetCode snippet
schema.decode(data)
2.2.222.63MNoneAll errors6 μs
8.67x
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.0320.77KJITAll errors8 μs
11.2x
stat_minus_1
sury (safe)
Code snippetCode snippet
S.safe(() => parser(data))
11.0.0-rc.0320.77KJITAll errors8 μs
11.23x
stat_minus_1
@paseri/compiler (parse)
Code snippetCode snippet
Product.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.7103PrecompiledAll errors8 μs
11.91x
stat_minus_1
effect
Code snippetCode snippet
// const decodeFirst = Schema.decodeUnknownEither(
//  schema, 
//  { errors: "first" }
// );
decodeFirst(data)

(Commented code is not benchmarked)

3.22.026.04MNoneAbort early9 μs
13.97x
stat_minus_1
superstruct
Code snippetCode snippet
validate(data, schema)
2.0.25.44MNoneAbort early10 μs
14.93x
stat_minus_1
superstruct (schema.validate)
Code snippetCode snippet
schema.validate(data)
2.0.25.44MNoneAbort early10 μs
15.26x
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.793NoneAll errors10 μs
15.37x
stat_minus_1
typia (createValidate)
Code snippetCode snippet
// const validate = typia.createValidate<TypiaSchema>();
validate(data);

(Commented code is not benchmarked)

13.2.0350.5KPrecompiledAll errors17 μs
25.82x
stat_minus_1
typia (validate)
Code snippetCode snippet
typia.validate<TypiaSchema>(data)
13.2.0350.5KPrecompiledAll errors19 μs
27.91x
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.10126.04MNoneAll errors22 μs
32.23x
stat_minus_1
valibot (abortPipeEarly only)
Code snippetCode snippet
v.safeParse(schema, data, { abortPipeEarly: true })
1.4.216.52MNoneAbort early30 μs
44.08x
stat_minus_1
valibot
Code snippetCode snippet
v.safeParse(schema, data)
1.4.216.52MNoneAll errors30 μs
44.7x
stat_minus_1
@railway-ts/pipelines
Code snippetCode snippet
validate(data, schema)
0.1.29225NoneAll errors31 μs
46.58x
stat_minus_1
effect
Code snippetCode snippet
// const decodeAll = Schema.decodeUnknownEither(
//  schema, 
//  { errors: "all" }
// );
decodeAll(data)

(Commented code is not benchmarked)

3.22.026.04MNoneAll errors31 μs
46.91x
stat_minus_1
zod/v3
Code snippetCode snippet
schema.safeParse(data)
4.4.3251.7MNoneAll errors41 μs
61.07x
stat_minus_1
joi
Code snippetCode snippet
schema.validate(data, { abortEarly: false })
18.2.323.54MNoneAll errors62 μs
92.62x
stat_minus_1
zod/mini (jitless)
Code snippetCode snippet
schema.safeParse(data, { jitless: true })
4.4.3251.7MNoneAll errors65 μs
97.23x
stat_minus_1
zod/mini
Code snippetCode snippet
schema.safeParse(data)
4.4.3251.7MJITAll errors65 μs
97.52x
stat_minus_1
decoders
Code snippetCode snippet
schema.decode(data)
2.9.337.07KNoneAll errors70 μs
103.88x
stat_minus_1
zod
Code snippetCode snippet
schema.safeParse(data)
4.4.3251.7MJITAll errors77 μs
115.64x
stat_minus_1
superstruct
Code snippetCode snippet
const [error] = validate(data, schema);
for (const failure of error.failures()) {
  // ...
}
2.0.25.44MNoneAll errors81 μs
120.23x
stat_minus_1
superstruct
Code snippetCode snippet
const [error] = schema.validate(data);
for (const failure of error.failures()) {
  // ...
}
2.0.25.44MNoneAll errors81 μs
120.57x
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.106.97MJITAll errors82 μs
122.11x
stat_minus_1
zod (jitless)
Code snippetCode snippet
schema.safeParse(data, { jitless: true })
4.4.3251.7MNoneAll errors82 μs
122.38x
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.106.97MJITAll errors87 μs
129.31x
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.106.97MJITAll errors91 μs
135.34x
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.106.97MJITAll errors92 μs
137.97x
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.02MNoneAbort early96 μs
143.95x
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.106.97MJITAll errors98 μs
145.65x
stat_minus_1
arktype
Code snippetCode snippet
schema(data)
2.2.31.36MJITAll errors99 μs
147.51x
stat_minus_1
runtypes
Code snippetCode snippet
schema.inspect(data)
7.0.4252.38KNoneAbort early191 μs
285.19x
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.4252.38KNoneAbort early208 μs
310.84x
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.
4.0.01.1MNoneAll errors273 μs
407.85x
stat_minus_2
@sapphire/shapeshift (run)
Code snippetCode snippet
schema.run(data)
4.0.01.1MNoneAll errors280 μs
417.54x
stat_minus_2
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.02MNoneAll errors537 μs
801.89x
stat_minus_3
Created by eskimojo for Open Circle

Preferences

Style
Theme
NPM browser
Code ligatures