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
    • assignment_turned_in
      TypeScript

  • 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.63.256.02KJITAll errors46 ns
zod-compiler (bag + mini)
Code snippetCode snippet
bagMiniSchema.safeParse(data)
2.0.8138.03KPrecompiledAll errors47 ns
1.03x
stat_minus_1
zod-compiler (bag)
Code snippetCode snippet
bagSchema.safeParse(data)
2.0.8138.03KPrecompiledAll errors47 ns
1.03x
stat_minus_1
zod-compiler (mini)
Code snippetCode snippet
miniSchema.safeParse(data)
2.0.8138.03KPrecompiledAll errors47 ns
1.03x
stat_minus_1
zod-compiler
Code snippetCode snippet
schema.safeParse(data)
2.0.8138.03KPrecompiledAll errors48 ns
1.05x
stat_minus_1
zod-compiler (compact + mini)
Code snippetCode snippet
compactMiniSchema.safeParse(data)
2.0.8138.03KPrecompiledAll errors50 ns
1.1x
stat_minus_1
zod-compiler (compact)
Code snippetCode snippet
compactSchema.safeParse(data)
2.0.8138.03KPrecompiledAll errors52 ns
1.13x
stat_minus_1
@remix-run/data-schema
Code snippetCode snippet
parseSafe(schema, data, { abortEarly: true })
1.0.067.15KNoneAbort early282 ns
6.14x
stat_minus_1
valibot
Code snippetCode snippet
v.safeParse(schema, data, { abortEarly: true })
1.5.033.44MNoneAbort early425 ns
9.27x
stat_minus_1
@railway-ts/pipelines
Code snippetCode snippet
validate(data, schema, { abortEarly: true })
0.1.2937NoneAbort early485 ns
10.56x
stat_minus_1
effect
Code snippetCode snippet
const decode = Schema.decodeUnknownOption(schema);
decode(data, { errors: "first" })

(Setup code is not benchmarked)

4.1.4n/aNoneAbort early663 ns
14.45x
stat_minus_1
@mionjs/run-types
Code snippetCode snippet
const validate = createValidateFn<MionSchema>();
const getErrors = createGetValidationErrorsFn<MionSchema>();
validate(data) ? data : getErrors(data);

(Setup code is not benchmarked)

0.14.1770PrecompiledAll errors746 ns
16.27x
stat_minus_1
@paseri/compiler (safeParse)
Code snippetCode snippet
schema.safeParse(data)
0.7.7547PrecompiledAll errors1 μs
23.83x
stat_minus_1
@paseri/paseri (safeParse)
Code snippetCode snippet
p.object(shape).safeParse(data)
1.9.7606NoneAll errors3 μs
62.98x
stat_minus_1
joi (no convert)
Code snippetCode snippet
schema.validate(data, { abortEarly: true, convert: false })
18.3.232.82MNoneAbort early3 μs
67.4x
stat_minus_1
joi
Code snippetCode snippet
schema.validate(data, { abortEarly: true })
18.3.232.82MNoneAbort early3 μs
69.7x
stat_minus_1
sury (asResult)
Code snippetCode snippet
const parseAsResult = S.parseAsResult(S.schema(value));
parseAsResult(data);

(Setup code is not benchmarked)

11.1.0516.34KJITAll errors3 μs
70.89x
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.1.0516.34KJITAll errors3 μs
74.19x
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.7547PrecompiledAll errors4 μs
80.76x
stat_minus_1
io-ts
Code snippetCode snippet
schema.decode(data)
2.2.223.57MNoneAll errors4 μs
85.49x
stat_minus_1
ata-validator (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.
1.63.256.02KJITAll errors4 μs
94.94x
stat_minus_1
superstruct
Code snippetCode snippet
validate(data, schema)
2.0.29.29MNoneAbort early5 μs
116x
stat_minus_1
superstruct (schema.validate)
Code snippetCode snippet
schema.validate(data)
2.0.29.29MNoneAbort early5 μs
116.06x
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.7606NoneAll errors6 μs
122.76x
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.4.7n/aJITAll errors7 μs
152.27x
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.4.7n/aJITAll errors7 μs
153.05x
stat_minus_1
valibot (abortPipeEarly only)
Code snippetCode snippet
v.safeParse(schema, data, { abortPipeEarly: true })
1.5.033.44MNoneAbort early8 μs
181.13x
stat_minus_1
valibot
Code snippetCode snippet
v.safeParse(schema, data)
1.5.033.44MNoneAll errors8 μs
183.07x
stat_minus_1
typia (createValidate)
Code snippetCode snippet
const validate = typia.createValidate<TypiaSchema>();
validate(data);

(Setup code is not benchmarked)

15.4.1520.42KPrecompiledAll errors9 μs
194.45x
stat_minus_1
typia (validate)
Code snippetCode snippet
typia.validate<TypiaSchema>(data)
15.4.1520.42KPrecompiledAll errors9 μs
195.86x
stat_minus_1
@remix-run/data-schema
Code snippetCode snippet
parseSafe(schema, data)
1.0.067.15KNoneAll errors10 μs
207.44x
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.4.7n/aJITAll errors10 μs
210.01x
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.4.7n/aJITAll errors10 μs
215.24x
stat_minus_1
zod
Code snippetCode snippet
schema.safeParse(data)
4.6.7462.27MJITAll errors10 μs
215.33x
stat_minus_1
zod (compile)
Code snippetCode snippet
compiledSchema.safeParse(data)
4.6.7462.27MJITAll errors10 μs
217.87x
stat_minus_1
effect
Code snippetCode snippet
const decode = Schema.decodeUnknownOption(schema);
decode(data, { errors: "all" })

(Setup code is not benchmarked)

4.1.4n/aNoneAll errors12 μs
253.16x
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.4.7n/aJITAll errors13 μs
276.23x
stat_minus_1
@railway-ts/pipelines
Code snippetCode snippet
validate(data, schema)
0.1.2937NoneAll errors16 μs
339.49x
stat_minus_1
zod/mini
Code snippetCode snippet
schema.safeParse(data)
4.6.7462.27MJITAll errors16 μs
355.62x
stat_minus_1
zod/mini (compile)
Code snippetCode snippet
compiledSchema.safeParse(data)
4.6.7462.27MJITAll errors16 μs
356.98x
stat_minus_1
zod/mini (jitless)
Code snippetCode snippet
schema.safeParse(data, { jitless: true })
4.6.7462.27MNoneAll errors16 μs
359.31x
stat_minus_1
zod (jitless)
Code snippetCode snippet
schema.safeParse(data, { jitless: true })
4.6.7462.27MNoneAll errors17 μs
362.55x
stat_minus_1
zod/v3
Code snippetCode snippet
schema.safeParse(data)
4.6.7462.27MNoneAll errors23 μs
510.29x
stat_minus_1
decoders
Code snippetCode snippet
schema.decode(data)
2.13.0n/aNoneAll errors36 μs
780.59x
stat_minus_1
joi (no convert)
Code snippetCode snippet
schema.validate(data, { abortEarly: false, convert: false })
18.3.232.82MNoneAll errors38 μs
826.13x
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 early39 μs
859.49x
stat_minus_1
joi
Code snippetCode snippet
schema.validate(data, { abortEarly: false })
18.3.232.82MNoneAll errors41 μs
893.82x
stat_minus_1
superstruct (schema.validate)
Code snippetCode snippet
const [error] = schema.validate(data);
for (const failure of error.failures()) {
  // ...
}
2.0.29.29MNoneAll errors54 μs
1_173.13x
stat_minus_1
superstruct
Code snippetCode snippet
const [error] = validate(data, schema);
for (const failure of error.failures()) {
  // ...
}
2.0.29.29MNoneAll errors54 μs
1_179.72x
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 early57 μs
1_238.6x
stat_minus_1
arktype
Code snippetCode snippet
schema(data)
2.2.9n/aJITAll errors70 μs
1_536.24x
stat_minus_1
@sapphire/shapeshift (run)
Code snippetCode snippet
schema.run(data)
5.0.0n/aNoneAll errors101 μs
2_204.47x
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.
5.0.0n/aNoneAll errors102 μs
2_216.05x
stat_minus_2
runtypes (inspect)
Code snippetCode snippet
schema.inspect(data)
7.0.5n/aNoneAbort early127 μs
2_777.23x
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 early134 μs
2_917.38x
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 errors246 μs
5_371.61x
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 errors265 μs
5_781.51x
stat_minus_3
Created by eskimojo for Open Circle

Preferences

Style
Theme
NPM browser
Code ligatures