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
    • verified
      Compliance

    • 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 typed value, instead of a boolean.

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
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
ata-validator
Code snippetCode snippet
schema.validate(data)
1.25.0n/aJITAll errors75 ns
@remix-run/data-schema
Code snippetCode snippet
parseSafe(schema, data, { abortEarly: true })
0.3.0n/aNoneAbort early314 ns
4.2x
stat_minus_1
valibot
Code snippetCode snippet
v.safeParse(schema, data, { abortEarly: true })
1.5.0n/aNoneAbort early559 ns
7.48x
stat_minus_1
@railway-ts/pipelines
Code snippetCode snippet
validate(data, schema, { abortEarly: true })
0.1.29n/aNoneAbort early614 ns
8.21x
stat_minus_1
effect@rc
Code snippetCode snippet
const decode = Schema.decodeUnknownOption(schema);
decode(data, { errors: "first" })

(Setup code is not benchmarked)

4.0.0-rc.112n/aNoneAbort early809 ns
10.83x
stat_minus_1
@paseri/compiler (safeParse)
Code snippetCode snippet
schema.safeParse(data)
0.7.7169PrecompiledAll errors1 μs
18.07x
stat_minus_1
@paseri/paseri (safeParse)
Code snippetCode snippet
p.object(shape).safeParse(data)
1.9.7186NoneAll errors4 μs
49.38x
stat_minus_1
joi (no convert)
Code snippetCode snippet
schema.validate(data, { abortEarly: true, convert: false })
18.2.9n/aNoneAbort early4 μs
51.7x
stat_minus_1
sury (asResult + compiled)
Code snippetCode snippet
const parseAsResult = S.parseAsResult(S.schema(value));
parseAsResult(data);

(Setup code is not benchmarked)

11.0.0n/aJITAll errors4 μs
53.83x
stat_minus_1
sury (parseOrThrow + compiled)
Code snippetCode snippet
const parse = S.parseOrThrow(S.schema(value));
parse(data);

(Setup 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.0n/aJITAll errors4 μs
54x
stat_minus_1
joi
Code snippetCode snippet
schema.validate(data, { abortEarly: true })
18.2.9n/aNoneAbort early4 μs
54.32x
stat_minus_1
sury (asResult)
Code snippetCode snippet
S.parseAsResult(schema, data)
11.0.0n/aJITAll errors4 μs
55.73x
stat_minus_1
sury
Code snippetCode snippet
S.parseOrThrow(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.
11.0.0n/aJITAll errors4 μs
59.8x
stat_minus_1
effect
Code snippetCode snippet
const decodeFirst = Schema.decodeUnknownEither(schema, { errors: "first" });
decodeFirst(data)

(Setup code is not benchmarked)

3.22.2n/aNoneAbort early5 μs
61.52x
stat_minus_1
@paseri/compiler (parse)
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.
0.7.7169PrecompiledAll errors5 μs
62.54x
stat_minus_1
io-ts
Code snippetCode snippet
schema.decode(data)
2.2.22n/aNoneAll errors5 μs
67.43x
stat_minus_1
zod-compiler (compact)
Code snippetCode snippet
compactSchema.safeParse(data)
2.0.5n/aPrecompiledAll errors6 μs
86.08x
stat_minus_1
typebox (schema compile)
Code snippetCode snippet
const compiledSchema = Schema.Compile(schema);
compiledSchema.Parse(data);

(Setup 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.33n/aJITAll errors6 μs
86.95x
stat_minus_1
superstruct
Code snippetCode snippet
validate(data, schema)
2.0.2n/aNoneAbort early7 μs
87.66x
stat_minus_1
typebox (script compile)
Code snippetCode snippet
const compiledScriptSchema = Schema.Compile(scriptSchema);
compiledScriptSchema.Parse(data);

(Setup 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.33n/aJITAll errors7 μs
87.67x
stat_minus_1
superstruct (schema.validate)
Code snippetCode snippet
schema.validate(data)
2.0.2n/aNoneAbort early7 μs
88.68x
stat_minus_1
@paseri/paseri (parse)
Code snippetCode snippet
p.object(shape).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.7186NoneAll errors7 μs
99.76x
stat_minus_1
zod-compiler (bag)
Code snippetCode snippet
bagSchema.safeParse(data)
2.0.5n/aPrecompiledAll errors10 μs
132.72x
stat_minus_1
typebox (compile)
Code snippetCode snippet
const compiled = Compile(schema);
compiled.Parse(data);

(Setup 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.33n/aJITAll errors10 μs
133.52x
stat_minus_1
zod-compiler
Code snippetCode snippet
schema.safeParse(data)
2.0.5n/aPrecompiledAll errors10 μs
133.66x
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.33n/aJITAll errors10 μs
139.8x
stat_minus_1
valibot (abortPipeEarly only)
Code snippetCode snippet
v.safeParse(schema, data, { abortPipeEarly: true })
1.5.0n/aNoneAbort early11 μs
140.9x
stat_minus_1
valibot
Code snippetCode snippet
v.safeParse(schema, data)
1.5.0n/aNoneAll errors11 μs
142.9x
stat_minus_1
zod
Code snippetCode snippet
schema.safeParse(data)
4.6.5n/aJITAll errors12 μs
167x
stat_minus_1
zod (compile)
Code snippetCode snippet
compiledSchema.safeParse(data)
4.6.5n/aJITAll errors13 μs
168.4x
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.33n/aJITAll errors14 μs
183.55x
stat_minus_1
@remix-run/data-schema
Code snippetCode snippet
parseSafe(schema, data)
0.3.0n/aNoneAll errors15 μs
202.77x
stat_minus_1
typia (validate)
Code snippetCode snippet
typia.validate<TypiaSchema>(data)
14.0.6n/aPrecompiledAll errors17 μs
221.76x
stat_minus_1
typia (createValidate)
Code snippetCode snippet
const validate = typia.createValidate<TypiaSchema>();
validate(data);

(Setup code is not benchmarked)

14.0.6n/aPrecompiledAll errors17 μs
222.41x
stat_minus_1
effect@rc
Code snippetCode snippet
const decode = Schema.decodeUnknownOption(schema);
decode(data, { errors: "all" })

(Setup code is not benchmarked)

4.0.0-rc.112n/aNoneAll errors17 μs
224.23x
stat_minus_1
@railway-ts/pipelines
Code snippetCode snippet
validate(data, schema)
0.1.29n/aNoneAll errors20 μs
270.51x
stat_minus_1
zod/mini
Code snippetCode snippet
schema.safeParse(data)
4.6.5n/aJITAll errors20 μs
270.92x
stat_minus_1
zod/mini (jitless)
Code snippetCode snippet
schema.safeParse(data, { jitless: true })
4.6.5n/aNoneAll errors20 μs
274.13x
stat_minus_1
zod (jitless)
Code snippetCode snippet
schema.safeParse(data, { jitless: true })
4.6.5n/aNoneAll errors21 μs
278.16x
stat_minus_1
zod/mini (compile)
Code snippetCode snippet
compiledSchema.safeParse(data)
4.6.5n/aJITAll errors21 μs
279.45x
stat_minus_1
effect
Code snippetCode snippet
const decodeAll = Schema.decodeUnknownEither(schema, { errors: "all" });
decodeAll(data)

(Setup code is not benchmarked)

3.22.2n/aNoneAll errors22 μs
300.62x
stat_minus_1
zod/v3
Code snippetCode snippet
schema.safeParse(data)
4.6.5n/aNoneAll errors29 μs
391.08x
stat_minus_1
joi (no convert)
Code snippetCode snippet
schema.validate(data, { abortEarly: false, convert: false })
18.2.9n/aNoneAll errors49 μs
660.42x
stat_minus_1
yup (strict)
Code snippetCode snippet
schema.validateSync(data, { abortEarly: true, strict: 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.1n/aNoneAbort early50 μs
671.56x
stat_minus_1
decoders
Code snippetCode snippet
schema.decode(data)
2.10.1n/aNoneAll errors52 μs
697.07x
stat_minus_1
joi
Code snippetCode snippet
schema.validate(data, { abortEarly: false })
18.2.9n/aNoneAll errors53 μs
710.93x
stat_minus_1
superstruct
Code snippetCode snippet
const [error] = validate(data, schema);
for (const failure of error.failures()) {
  // ...
}
2.0.2n/aNoneAll errors66 μs
885.78x
stat_minus_1
superstruct (schema.validate)
Code snippetCode snippet
const [error] = schema.validate(data);
for (const failure of error.failures()) {
  // ...
}
2.0.2n/aNoneAll errors66 μs
886.53x
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.1n/aNoneAbort early73 μs
976.62x
stat_minus_1
arktype
Code snippetCode snippet
schema(data)
2.2.3n/aJITAll errors89 μs
1_189.14x
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.
5.0.0n/aNoneAll errors122 μs
1_626.32x
stat_minus_2
@sapphire/shapeshift (run)
Code snippetCode snippet
schema.run(data)
5.0.0n/aNoneAll errors122 μs
1_633.95x
stat_minus_2
runtypes (inspect)
Code snippetCode snippet
schema.inspect(data)
7.0.5n/aNoneAbort early161 μs
2_153.52x
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.5n/aNoneAbort early174 μs
2_324.17x
stat_minus_2
yup (strict)
Code snippetCode snippet
schema.validateSync(data, { abortEarly: false, strict: 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.1n/aNoneAll errors319 μs
4_266.62x
stat_minus_3
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.1n/aNoneAll errors347 μs
4_640.12x
stat_minus_3
Created by eskimojo for Open Circle

Preferences

Style
Theme
NPM browser
Code ligatures