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

    • article
      Blog
Code styleCode style
Normal styleNormal style
System themeSystem theme
Light themeLight theme
Dark themeDark theme
Expand sidebarExpand sidebar
Benchmarks/ParsingParsing
Code styleCode style
Normal styleNormal style
System themeSystem theme
Light themeLight theme
Dark themeDark theme
github
GitHubGitHub
DiscordDiscord

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
errorInvalidcheck_circleValid
Optimizations
flash_offNonecodeJITbuildPrecompiled
Abort early
errorAll errorswarningAbort early
Libraryarrow_upwardVersionDownloads (/wk)sortOptimizationsError typeMeansortCompare
@railway-ts/pipelines
Code snippetCode snippet
validate(data, schema, { abortEarly: true })
0.1.2734NoneAbort early643 ns
@railway-ts/pipelines
Code snippetCode snippet
validate(data, schema)
0.1.2734NoneAll errors29 μs
45.24x
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.
4.0.0629.44KNoneAll errors260 μs
404.3x
stat_minus_2
@sapphire/shapeshift (run)
Code snippetCode snippet
schema.run(data)
4.0.0629.44KNoneAll errors262 μs
407.37x
stat_minus_2
arktype
Code snippetCode snippet
schema(data)
2.2.0885.45KJITAll errors91 μs
141.01x
stat_minus_1
ata-validator
Code snippetCode snippet
schema.validate(data)
0.8.0728JITAll errors682 ns
1.06x
stat_minus_1
decoders
Code snippetCode snippet
schema.decode(data)
2.9.338.55KNoneAll errors74 μs
114.32x
stat_minus_1
effect
Code snippetCode snippet
// const decodeFirst = Schema.decodeUnknownEither(
//  schema, 
//  { errors: "first" }
// );
decodeFirst(data)

(Commented code is not benchmarked)

3.21.09.44MNoneAbort early9 μs
14.67x
stat_minus_1
effect
Code snippetCode snippet
// const decodeAll = Schema.decodeUnknownEither(
//  schema, 
//  { errors: "all" }
// );
decodeAll(data)

(Commented code is not benchmarked)

3.21.09.44MNoneAll errors31 μs
47.9x
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.469.44MNoneAbort early1 μs
1.83x
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.469.44MNoneAll errors22 μs
33.6x
stat_minus_1
io-ts
Code snippetCode snippet
schema.decode(data)
2.2.222.92MNoneAll errors6 μs
9.54x
stat_minus_1
joi
Code snippetCode snippet
schema.validate(data, { abortEarly: true })
18.1.218.74MNoneAbort early4 μs
6.28x
stat_minus_1
joi
Code snippetCode snippet
schema.validate(data, { abortEarly: false })
18.1.218.74MNoneAll errors55 μs
85.51x
stat_minus_1
runtypes
Code snippetCode snippet
schema.inspect(data)
7.0.4279.42KNoneAbort early182 μs
282.85x
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.4279.42KNoneAbort early185 μs
287.99x
stat_minus_2
superstruct
Code snippetCode snippet
validate(data, schema)
2.0.24.02MNoneAbort early10 μs
15.36x
stat_minus_1
superstruct
Code snippetCode snippet
const [error] = validate(data, schema);
for (const failure of error.failures()) {
  // ...
}
2.0.24.02MNoneAll errors74 μs
115.07x
stat_minus_1
superstruct
Code snippetCode snippet
const [error] = schema.validate(data);
for (const failure of error.failures()) {
  // ...
}
2.0.24.02MNoneAll errors75 μs
115.94x
stat_minus_1
superstruct (schema.validate)
Code snippetCode snippet
schema.validate(data)
2.0.24.02MNoneAbort early10 μs
15.76x
stat_minus_1
sury
Code snippetCode snippet
S.parseOrThrow(data, schema)
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.4146.04KJITAll errors8 μs
12.22x
stat_minus_1
sury (compile + safe)
Code snippetCode snippet
// const compile = S.compile(S.schema(...));
S.safe(() => compile(data));

(Commented code is not benchmarked)

11.0.0-alpha.4146.04KJITAll errors8 μs
11.96x
stat_minus_1
sury (compile)
Code snippetCode snippet
// const compile = S.compile(S.schema(...));
compile(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.4146.04KJITAll errors7 μs
11.45x
stat_minus_1
sury (safe)
Code snippetCode snippet
S.safe(() => S.parseOrThrow(data, schema))
11.0.0-alpha.4146.04KJITAll errors8 μs
12.17x
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.1.23277.92KJITAll errors88 μs
136.71x
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.1.23277.92KJITAll errors82 μs
128.1x
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.1.23277.92KJITAll errors76 μs
118.6x
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.1.23277.92KJITAll errors80 μs
124.41x
stat_minus_1
typia (createValidate)
Code snippetCode snippet
// const validate = typia.createValidate<TypiaSchema>();
validate(data);

(Commented code is not benchmarked)

12.0.2259.06KPrecompiledAll errors6 μs
9.48x
stat_minus_1
typia (validate)
Code snippetCode snippet
typia.validate<TypiaSchema>(data)
12.0.2259.06KPrecompiledAll errors6 μs
10.01x
stat_minus_1
valibot
Code snippetCode snippet
v.safeParse(schema, data, { abortEarly: true })
1.3.17.93MNoneAbort early701 ns
1.09x
stat_minus_1
valibot
Code snippetCode snippet
v.safeParse(schema, data)
1.3.17.93MNoneAll errors27 μs
41.82x
stat_minus_1
valibot (abortPipeEarly only)
Code snippetCode snippet
v.safeParse(schema, data, { abortPipeEarly: true })
1.3.17.93MNoneAbort early28 μs
42.92x
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.110.79MNoneAbort early85 μs
132.05x
stat_minus_1
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.110.79MNoneAll errors480 μs
746.27x
stat_minus_3
zod
Code snippetCode snippet
schema.safeParse(data)
4.3.6151.14MJITAll errors73 μs
114.01x
stat_minus_1
zod (jitless)
Code snippetCode snippet
schema.safeParse(data, { jitless: true })
4.3.6151.14MNoneAll errors78 μs
121.87x
stat_minus_1
zod/mini
Code snippetCode snippet
schema.safeParse(data)
4.3.6151.14MJITAll errors64 μs
99.04x
stat_minus_1
zod/mini (jitless)
Code snippetCode snippet
schema.safeParse(data, { jitless: true })
4.3.6151.14MNoneAll errors64 μs
99.11x
stat_minus_1
zod/v3
Code snippetCode snippet
schema.safeParse(data)
4.3.6151.14MNoneAll errors37 μs
57.88x
stat_minus_1
Created by eskimojo for Open Circle