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

    • 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
LibrarysortVersionDownloads (/wk)sortOptimizationsError typeMeanarrow_upwardCompare
@railway-ts/pipelines
Code snippetCode snippet
validate(data, schema, { abortEarly: true })
0.1.29131NoneAbort early624 ns
ata-validator
Code snippetCode snippet
schema.validate(data)
1.2.2979JITAll errors653 ns
1.05x
stat_minus_1
valibot
Code snippetCode snippet
v.safeParse(schema, data, { abortEarly: true })
1.4.215.65MNoneAbort early707 ns
1.13x
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.02MNoneAbort early1 μs
2.09x
stat_minus_1
@paseri/compiler (safeParse)
Code snippetCode snippet
Product.safeParse(data)
0.7.7104PrecompiledAll errors1 μs
2.28x
stat_minus_1
@paseri/paseri (safeParse)
Code snippetCode snippet
p.object(...).safeParse(data)
1.9.7108NoneAll errors4 μs
6.18x
stat_minus_1
joi
Code snippetCode snippet
schema.validate(data, { abortEarly: true })
18.2.323.69MNoneAbort early4 μs
6.56x
stat_minus_1
io-ts
Code snippetCode snippet
schema.decode(data)
2.2.222.71MNoneAll errors6 μs
9.77x
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-alpha.11291.77KJITAll errors7 μs
11.28x
stat_minus_1
sury (safe)
Code snippetCode snippet
S.safe(() => parser(data))
11.0.0-alpha.11291.77KJITAll errors7 μs
11.53x
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.7104PrecompiledAll errors7 μs
11.76x
stat_minus_1
effect
Code snippetCode snippet
// const decodeFirst = Schema.decodeUnknownEither(
//  schema, 
//  { errors: "first" }
// );
decodeFirst(data)

(Commented code is not benchmarked)

3.22.026.02MNoneAbort early9 μs
14.4x
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.7108NoneAll errors10 μs
15.61x
stat_minus_1
superstruct
Code snippetCode snippet
validate(data, schema)
2.0.25.65MNoneAbort early10 μs
16.35x
stat_minus_1
superstruct (schema.validate)
Code snippetCode snippet
schema.validate(data)
2.0.25.65MNoneAbort early11 μs
17.21x
stat_minus_1
typia (createValidate)
Code snippetCode snippet
// const validate = typia.createValidate<TypiaSchema>();
validate(data);

(Commented code is not benchmarked)

13.2.0322.95KPrecompiledAll errors17 μs
26.82x
stat_minus_1
typia (validate)
Code snippetCode snippet
typia.validate<TypiaSchema>(data)
13.2.0322.95KPrecompiledAll errors18 μs
28.21x
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.02MNoneAll errors22 μs
34.86x
stat_minus_1
valibot (abortPipeEarly only)
Code snippetCode snippet
v.safeParse(schema, data, { abortPipeEarly: true })
1.4.215.65MNoneAbort early27 μs
43.36x
stat_minus_1
valibot
Code snippetCode snippet
v.safeParse(schema, data)
1.4.215.65MNoneAll errors27 μs
43.96x
stat_minus_1
@railway-ts/pipelines
Code snippetCode snippet
validate(data, schema)
0.1.29131NoneAll errors29 μs
46.65x
stat_minus_1
effect
Code snippetCode snippet
// const decodeAll = Schema.decodeUnknownEither(
//  schema, 
//  { errors: "all" }
// );
decodeAll(data)

(Commented code is not benchmarked)

3.22.026.02MNoneAll errors30 μs
47.29x
stat_minus_1
zod/v3
Code snippetCode snippet
schema.safeParse(data)
4.4.3240.5MNoneAll errors37 μs
59.03x
stat_minus_1
joi
Code snippetCode snippet
schema.validate(data, { abortEarly: false })
18.2.323.69MNoneAll errors56 μs
89.64x
stat_minus_1
zod/mini (jitless)
Code snippetCode snippet
schema.safeParse(data, { jitless: true })
4.4.3240.5MNoneAll errors58 μs
92.26x
stat_minus_1
zod/mini
Code snippetCode snippet
schema.safeParse(data)
4.4.3240.5MJITAll errors58 μs
92.49x
stat_minus_1
zod
Code snippetCode snippet
schema.safeParse(data)
4.4.3240.5MJITAll errors63 μs
101.64x
stat_minus_1
decoders
Code snippetCode snippet
schema.decode(data)
2.9.354.62KNoneAll errors65 μs
103.61x
stat_minus_1
zod (jitless)
Code snippetCode snippet
schema.safeParse(data, { jitless: true })
4.4.3240.5MNoneAll errors68 μs
109.59x
stat_minus_1
superstruct
Code snippetCode snippet
const [error] = schema.validate(data);
for (const failure of error.failures()) {
  // ...
}
2.0.25.65MNoneAll errors74 μs
118.44x
stat_minus_1
superstruct
Code snippetCode snippet
const [error] = validate(data, schema);
for (const failure of error.failures()) {
  // ...
}
2.0.25.65MNoneAll errors75 μs
120.88x
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.85.5MJITAll errors77 μs
123.81x
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.85.5MJITAll errors82 μs
131.24x
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.65MNoneAbort early84 μs
134.08x
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.85.5MJITAll errors84 μs
134.81x
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.85.5MJITAll errors87 μs
139.59x
stat_minus_1
arktype
Code snippetCode snippet
schema(data)
2.2.31.39MJITAll errors89 μs
143.34x
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.85.5MJITAll errors91 μs
145.58x
stat_minus_1
runtypes
Code snippetCode snippet
schema.inspect(data)
7.0.4305.32KNoneAbort early170 μs
273.03x
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.4305.32KNoneAbort early181 μs
289.42x
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.06MNoneAll errors265 μs
424.14x
stat_minus_2
@sapphire/shapeshift (run)
Code snippetCode snippet
schema.run(data)
4.0.01.06MNoneAll errors266 μs
426.46x
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.65MNoneAll errors476 μs
762.92x
stat_minus_3
Created by eskimojo for Open Circle

Preferences

Style
Theme
NPM browser
Code ligatures