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
Libraryarrow_upwardVersiondownload/wksortOptimizationsError typeMeansortCompare
@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.7541PrecompiledAll errors5 μs
@paseri/compiler (safeParse)
Code snippetCode snippet
schema.safeParse(data)
0.7.7541PrecompiledAll errors1 μs
3.21x
stat_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.7520NoneAll errors7 μs
1.57x
stat_minus_1
@paseri/paseri (safeParse)
Code snippetCode snippet
p.object(shape).safeParse(data)
1.9.7520NoneAll errors4 μs
1.19x
stat_1
@railway-ts/pipelines
Code snippetCode snippet
validate(data, schema)
0.1.29n/aNoneAll errors21 μs
4.49x
stat_minus_1
@remix-run/data-schema
Code snippetCode snippet
parseSafe(schema, data)
1.0.0n/aNoneAll errors14 μs
3.06x
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 errors138 μs
29.13x
stat_minus_2
@sapphire/shapeshift (run)
Code snippetCode snippet
schema.run(data)
5.0.0n/aNoneAll errors132 μs
27.96x
stat_minus_2
arktype
Code snippetCode snippet
schema(data)
2.2.9n/aJITAll errors101 μs
21.32x
stat_minus_1
ata-validator
Code snippetCode snippet
schema.validate(data)
1.63.1n/aJITAll errors59 ns
79.75x
stat_3
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.1n/aJITAll errors6 μs
1.2x
stat_minus_1
decoders
Code snippetCode snippet
schema.decode(data)
2.13.0n/aNoneAll errors49 μs
10.36x
stat_minus_1
effect
Code snippetCode snippet
const decode = Schema.decodeUnknownOption(schema);
decode(data, { errors: "all" })

(Setup code is not benchmarked)

4.1.2n/aNoneAll errors15 μs
3.18x
stat_minus_1
io-ts
Code snippetCode snippet
schema.decode(data)
2.2.22n/aNoneAll errors5 μs
1.1x
stat_minus_1
joi
Code snippetCode snippet
schema.validate(data, { abortEarly: false })
18.3.2n/aNoneAll errors59 μs
12.52x
stat_minus_1
joi (no convert)
Code snippetCode snippet
schema.validate(data, { abortEarly: false, convert: false })
18.3.2n/aNoneAll errors55 μs
11.68x
stat_minus_1
superstruct
Code snippetCode snippet
const [error] = validate(data, schema);
for (const failure of error.failures()) {
  // ...
}
2.0.2n/aNoneAll errors71 μs
15.07x
stat_minus_1
superstruct (schema.validate)
Code snippetCode snippet
const [error] = schema.validate(data);
for (const failure of error.failures()) {
  // ...
}
2.0.2n/aNoneAll errors72 μs
15.17x
stat_minus_1
sury (asResult)
Code snippetCode snippet
const parseAsResult = S.parseAsResult(S.schema(value));
parseAsResult(data);

(Setup code is not benchmarked)

11.1.0n/aJITAll errors4 μs
1.12x
stat_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.0n/aJITAll errors5 μs
1x
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.4n/aJITAll errors17 μs
3.56x
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.4n/aJITAll errors13 μs
2.77x
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.4n/aJITAll errors10 μs
2.06x
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.4n/aJITAll errors13 μs
2.69x
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.4n/aJITAll errors9 μs
1.98x
stat_minus_1
typia (createValidate)
Code snippetCode snippet
const validate = typia.createValidate<TypiaSchema>();
validate(data);

(Setup code is not benchmarked)

15.2.2n/aPrecompiledAll errors12 μs
2.5x
stat_minus_1
typia (validate)
Code snippetCode snippet
typia.validate<TypiaSchema>(data)
15.2.2n/aPrecompiledAll errors12 μs
2.51x
stat_minus_1
valibot
Code snippetCode snippet
v.safeParse(schema, data)
1.5.0n/aNoneAll errors11 μs
2.29x
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.1n/aNoneAll errors390 μs
82.51x
stat_minus_3
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 errors355 μs
75.11x
stat_minus_3
zod
Code snippetCode snippet
schema.safeParse(data)
4.6.7n/aJITAll errors13 μs
2.65x
stat_minus_1
zod (compile)
Code snippetCode snippet
compiledSchema.safeParse(data)
4.6.7n/aJITAll errors14 μs
2.9x
stat_minus_1
zod (jitless)
Code snippetCode snippet
schema.safeParse(data, { jitless: true })
4.6.7n/aNoneAll errors21 μs
4.55x
stat_minus_1
zod-compiler
Code snippetCode snippet
schema.safeParse(data)
2.0.8n/aPrecompiledAll errors61 ns
77.89x
stat_3
zod-compiler (bag + mini)
Code snippetCode snippet
bagMiniSchema.safeParse(data)
2.0.8n/aPrecompiledAll errors61 ns
77.57x
stat_3
zod-compiler (bag)
Code snippetCode snippet
bagSchema.safeParse(data)
2.0.8n/aPrecompiledAll errors65 ns
72.16x
stat_3
zod-compiler (compact + mini)
Code snippetCode snippet
compactMiniSchema.safeParse(data)
2.0.8n/aPrecompiledAll errors61 ns
77.12x
stat_3
zod-compiler (compact)
Code snippetCode snippet
compactSchema.safeParse(data)
2.0.8n/aPrecompiledAll errors61 ns
77.15x
stat_3
zod-compiler (mini)
Code snippetCode snippet
miniSchema.safeParse(data)
2.0.8n/aPrecompiledAll errors61 ns
77.98x
stat_3
zod/mini
Code snippetCode snippet
schema.safeParse(data)
4.6.7n/aJITAll errors21 μs
4.46x
stat_minus_1
zod/mini (compile)
Code snippetCode snippet
compiledSchema.safeParse(data)
4.6.7n/aJITAll errors21 μs
4.49x
stat_minus_1
zod/mini (jitless)
Code snippetCode snippet
schema.safeParse(data, { jitless: true })
4.6.7n/aNoneAll errors21 μs
4.49x
stat_minus_1
zod/v3
Code snippetCode snippet
schema.safeParse(data)
4.6.7n/aNoneAll errors32 μs
6.75x
stat_minus_1
Created by eskimojo for Open Circle

Preferences

Style
Theme
NPM browser
Code ligatures