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.27364NoneAbort early655 ns
valibot
Code snippetCode snippet
v.safeParse(schema, data, { abortEarly: true })
1.3.18.61MNoneAbort early742 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.3511.72MNoneAbort early1 μs
1.71x
stat_minus_1
joi
Code snippetCode snippet
schema.validate(data, { abortEarly: true })
18.0.218.91MNoneAbort early4 μs
6.03x
stat_minus_1
io-ts
Code snippetCode snippet
schema.decode(data)
2.2.222.92MNoneAll errors6 μs
8.88x
stat_minus_1
typia (createValidate)
Code snippetCode snippet
// const validate = typia.createValidate<TypiaSchema>();
validate(data);

(Commented code is not benchmarked)

12.0.1261.03KPrecompiledAll errors6 μs
9.9x
stat_minus_1
typia (validate)
Code snippetCode snippet
typia.validate<TypiaSchema>(data)
12.0.1261.03KPrecompiledAll errors7 μs
10.53x
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.4158.32KJITAll errors8 μs
11.89x
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.4158.32KJITAll errors8 μs
12.35x
stat_minus_1
sury (safe)
Code snippetCode snippet
S.safe(() => S.parseOrThrow(data, schema))
11.0.0-alpha.4158.32KJITAll errors8 μs
12.8x
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.4158.32KJITAll errors8 μs
12.82x
stat_minus_1
effect
Code snippetCode snippet
// const decodeFirst = Schema.decodeUnknownEither(
//  schema, 
//  { errors: "first" }
// );
decodeFirst(data)

(Commented code is not benchmarked)

3.20.011.72MNoneAbort early9 μs
14.33x
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.3511.72MNoneAll errors20 μs
30.8x
stat_minus_1
valibot
Code snippetCode snippet
v.safeParse(schema, data)
1.3.18.61MNoneAll errors29 μs
43.62x
stat_minus_1
valibot (abortPipeEarly only)
Code snippetCode snippet
v.safeParse(schema, data, { abortPipeEarly: true })
1.3.18.61MNoneAbort early29 μs
44.09x
stat_minus_1
@railway-ts/pipelines
Code snippetCode snippet
validate(data, schema)
0.1.27364NoneAll errors31 μs
47.14x
stat_minus_1
effect
Code snippetCode snippet
// const decodeAll = Schema.decodeUnknownEither(
//  schema, 
//  { errors: "all" }
// );
decodeAll(data)

(Commented code is not benchmarked)

3.20.011.72MNoneAll errors31 μs
47.62x
stat_minus_1
zod/v3
Code snippetCode snippet
schema.safeParse(data)
4.3.6160.8MNoneAll errors40 μs
61.1x
stat_minus_1
joi
Code snippetCode snippet
schema.validate(data, { abortEarly: false })
18.0.218.91MNoneAll errors60 μs
90.84x
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.6281.23KJITAll errors71 μs
108.95x
stat_minus_1
zod/mini (jitless)
Code snippetCode snippet
schema.safeParse(data, { jitless: true })
4.3.6160.8MNoneAll errors74 μs
112.52x
stat_minus_1
zod/mini
Code snippetCode snippet
schema.safeParse(data)
4.3.6160.8MJITAll errors74 μs
113.55x
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.6281.23KJITAll errors75 μs
114.68x
stat_minus_1
decoders
Code snippetCode snippet
schema.decode(data)
2.9.137.21KNoneAll errors78 μs
119.25x
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.6281.23KJITAll errors80 μs
121.98x
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.6281.23KJITAll errors85 μs
130.22x
stat_minus_1
zod
Code snippetCode snippet
schema.safeParse(data)
4.3.6160.8MJITAll errors87 μs
132.29x
stat_minus_1
zod (jitless)
Code snippetCode snippet
schema.safeParse(data, { jitless: true })
4.3.6160.8MNoneAll errors92 μs
140.26x
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.63MNoneAbort early95 μs
145.31x
stat_minus_1
arktype
Code snippetCode snippet
schema(data)
2.2.0814.62KJITAll errors96 μs
146.87x
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.63MNoneAll errors537 μs
819.38x
stat_minus_3
Created by eskimojo for Open Circle