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
LibrarysortVersionDownloads (/wk)sortOptimizationsError typeMeanarrow_upwardCompare
@railway-ts/pipelines
Code snippetCode snippet
validate(data, schema, { abortEarly: true })
0.1.2731NoneAbort early651 ns
valibot
Code snippetCode snippet
v.safeParse(schema, data, { abortEarly: true })
1.3.17.46MNoneAbort early729 ns
1.12x
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.409.07MNoneAbort early1 μs
1.64x
stat_minus_1
ata-validator
Code snippetCode snippet
schema.validate(data)
0.4.151.85KJITAll errors1 μs
1.89x
stat_minus_1
joi
Code snippetCode snippet
schema.validate(data, { abortEarly: true })
18.1.118.59MNoneAbort early4 μs
5.99x
stat_minus_1
io-ts
Code snippetCode snippet
schema.decode(data)
2.2.222.81MNoneAll errors6 μs
8.92x
stat_minus_1
typia (createValidate)
Code snippetCode snippet
// const validate = typia.createValidate<TypiaSchema>();
validate(data);

(Commented code is not benchmarked)

12.0.1282.35KPrecompiledAll errors6 μs
9.92x
stat_minus_1
typia (validate)
Code snippetCode snippet
typia.validate<TypiaSchema>(data)
12.0.1282.35KPrecompiledAll errors7 μs
10.6x
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.4130.86KJITAll errors8 μs
12.29x
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.4130.86KJITAll errors8 μs
12.77x
stat_minus_1
sury (safe)
Code snippetCode snippet
S.safe(() => S.parseOrThrow(data, schema))
11.0.0-alpha.4130.86KJITAll errors8 μs
12.88x
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.4130.86KJITAll errors8 μs
12.91x
stat_minus_1
effect
Code snippetCode snippet
// const decodeFirst = Schema.decodeUnknownEither(
//  schema, 
//  { errors: "first" }
// );
decodeFirst(data)

(Commented code is not benchmarked)

3.21.09.07MNoneAbort early10 μs
14.78x
stat_minus_1
superstruct
Code snippetCode snippet
validate(data, schema)
2.0.24.11MNoneAbort early10 μs
15.71x
stat_minus_1
superstruct (schema.validate)
Code snippetCode snippet
schema.validate(data)
2.0.24.11MNoneAbort early10 μs
16.01x
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.409.07MNoneAll errors21 μs
31.78x
stat_minus_1
valibot (abortPipeEarly only)
Code snippetCode snippet
v.safeParse(schema, data, { abortPipeEarly: true })
1.3.17.46MNoneAbort early29 μs
44.13x
stat_minus_1
valibot
Code snippetCode snippet
v.safeParse(schema, data)
1.3.17.46MNoneAll errors29 μs
44.6x
stat_minus_1
@railway-ts/pipelines
Code snippetCode snippet
validate(data, schema)
0.1.2731NoneAll errors31 μs
47.85x
stat_minus_1
zod/v3
Code snippetCode snippet
schema.safeParse(data)
4.3.6146.36MNoneAll errors40 μs
61.03x
stat_minus_1
effect
Code snippetCode snippet
// const decodeAll = Schema.decodeUnknownEither(
//  schema, 
//  { errors: "all" }
// );
decodeAll(data)

(Commented code is not benchmarked)

3.21.09.07MNoneAll errors42 μs
63.84x
stat_minus_1
joi
Code snippetCode snippet
schema.validate(data, { abortEarly: false })
18.1.118.59MNoneAll errors61 μs
94.25x
stat_minus_1
decoders
Code snippetCode snippet
schema.decode(data)
2.9.141.51KNoneAll errors69 μs
105.33x
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.6227.83KJITAll errors71 μs
108.78x
stat_minus_1
zod/mini
Code snippetCode snippet
schema.safeParse(data)
4.3.6146.36MJITAll errors74 μs
114.24x
stat_minus_1
zod/mini (jitless)
Code snippetCode snippet
schema.safeParse(data, { jitless: true })
4.3.6146.36MNoneAll errors75 μs
114.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.6227.83KJITAll errors75 μs
114.66x
stat_minus_1
superstruct
Code snippetCode snippet
const [error] = validate(data, schema);
for (const failure of error.failures()) {
  // ...
}
2.0.24.11MNoneAll errors79 μs
121.87x
stat_minus_1
superstruct
Code snippetCode snippet
const [error] = schema.validate(data);
for (const failure of error.failures()) {
  // ...
}
2.0.24.11MNoneAll errors79 μs
121.97x
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.6227.83KJITAll errors80 μs
122.93x
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.6227.83KJITAll errors85 μs
131.39x
stat_minus_1
zod
Code snippetCode snippet
schema.safeParse(data)
4.3.6146.36MJITAll errors88 μs
135.66x
stat_minus_1
zod (jitless)
Code snippetCode snippet
schema.safeParse(data, { jitless: true })
4.3.6146.36MNoneAll errors92 μs
140.86x
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.53MNoneAbort early94 μs
144.73x
stat_minus_1
arktype
Code snippetCode snippet
schema(data)
2.2.0911.72KJITAll errors97 μs
148.47x
stat_minus_1
runtypes
Code snippetCode snippet
schema.inspect(data)
7.0.4264.28KNoneAbort early187 μs
287.28x
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.4264.28KNoneAbort early204 μs
313.37x
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.110.53MNoneAll errors540 μs
829.98x
stat_minus_3
Created by eskimojo for Open Circle