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)
Returns the same objectReturns the same object
This library returned the same object when parsing, instead of creating a new object.
1.63.153.34KJITAll errors591 ns
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.
Returns the same objectReturns the same object
This library returned the same object when parsing, instead of creating a new object.
1.4.4n/aJITAll errors713 ns
1.21x
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.
Returns the same objectReturns the same object
This library returned the same object when parsing, instead of creating a new object.
1.4.4n/aJITAll errors716 ns
1.21x
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.153.34KJITAll errors717 ns
1.21x
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.
Returns the same objectReturns the same object
This library returned the same object when parsing, instead of creating a new object.
1.4.4n/aJITAll errors723 ns
1.22x
stat_minus_1
@paseri/compiler (safeParse)
Code snippetCode snippet
schema.safeParse(data)
Returns the same objectReturns the same object
This library returned the same object when parsing, instead of creating a new object.
0.7.7541PrecompiledAll errors1 μs
1.74x
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.
Returns the same objectReturns the same object
This library returned the same object when parsing, instead of creating a new object.
0.7.7541PrecompiledAll errors1 μs
1.76x
stat_minus_1
zod-compiler (bag + mini)
Code snippetCode snippet
bagMiniSchema.safeParse(data)
2.0.8n/aPrecompiledAll errors1 μs
1.83x
stat_minus_1
zod-compiler (bag)
Code snippetCode snippet
bagSchema.safeParse(data)
2.0.8n/aPrecompiledAll errors1 μs
1.84x
stat_minus_1
zod-compiler
Code snippetCode snippet
schema.safeParse(data)
2.0.8n/aPrecompiledAll errors1 μs
1.87x
stat_minus_1
zod-compiler (compact + mini)
Code snippetCode snippet
compactMiniSchema.safeParse(data)
2.0.8n/aPrecompiledAll errors1 μs
1.88x
stat_minus_1
zod-compiler (mini)
Code snippetCode snippet
miniSchema.safeParse(data)
2.0.8n/aPrecompiledAll errors1 μs
1.91x
stat_minus_1
zod (compile)
Code snippetCode snippet
compiledSchema.safeParse(data)
4.6.7n/aJITAll errors1 μs
1.95x
stat_minus_1
zod-compiler (compact)
Code snippetCode snippet
compactSchema.safeParse(data)
2.0.8n/aPrecompiledAll errors1 μs
1.96x
stat_minus_1
zod/mini (compile)
Code snippetCode snippet
compiledSchema.safeParse(data)
4.6.7n/aJITAll errors1 μs
1.98x
stat_minus_1
typia (createValidate)
Code snippetCode snippet
const validate = typia.createValidate<TypiaSchema>();
validate(data);

(Setup code is not benchmarked)

Returns the same objectReturns the same object
This library returned the same object when parsing, instead of creating a new object.
15.2.2n/aPrecompiledAll errors1 μs
2.36x
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 errors2 μs
2.59x
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.0n/aJITAll errors2 μs
2.63x
stat_minus_1
typia (validate)
Code snippetCode snippet
typia.validate<TypiaSchema>(data)
Returns the same objectReturns the same object
This library returned the same object when parsing, instead of creating a new object.
15.2.2n/aPrecompiledAll errors2 μs
2.8x
stat_minus_1
@paseri/paseri (safeParse)
Code snippetCode snippet
p.object(shape).safeParse(data)
Returns the same objectReturns the same object
This library returned the same object when parsing, instead of creating a new object.
1.9.7520NoneAll errors3 μs
5.51x
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.
Returns the same objectReturns the same object
This library returned the same object when parsing, instead of creating a new object.
1.9.7520NoneAll errors3 μs
5.52x
stat_minus_1
io-ts
Code snippetCode snippet
schema.decode(data)
Returns the same objectReturns the same object
This library returned the same object when parsing, instead of creating a new object.
2.2.22n/aNoneAll errors5 μs
7.73x
stat_minus_1
zod
Code snippetCode snippet
schema.safeParse(data)
4.6.7n/aJITAll errors6 μs
10.1x
stat_minus_1
@remix-run/data-schema
Code snippetCode snippet
parseSafe(schema, data)
1.0.0n/aNoneAll errors7 μs
11.37x
stat_minus_1
valibot
Code snippetCode snippet
v.safeParse(schema, data)
1.5.0n/aNoneAll errors7 μs
11.63x
stat_minus_1
arktype
Code snippetCode snippet
schema(data)
Returns the same objectReturns the same object
This library returned the same object when parsing, instead of creating a new object.
2.2.9n/aJITAll errors8 μs
13.26x
stat_minus_1
decoders
Code snippetCode snippet
schema.decode(data)
2.13.0n/aNoneAll errors8 μs
13.79x
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 errors9 μs
15.73x
stat_minus_1
zod/mini
Code snippetCode snippet
schema.safeParse(data)
4.6.7n/aJITAll errors12 μs
21.09x
stat_minus_1
zod/mini (jitless)
Code snippetCode snippet
schema.safeParse(data, { jitless: true })
4.6.7n/aNoneAll errors12 μs
21.09x
stat_minus_1
zod/v3
Code snippetCode snippet
schema.safeParse(data)
4.6.7n/aNoneAll errors13 μs
21.44x
stat_minus_1
zod (jitless)
Code snippetCode snippet
schema.safeParse(data, { jitless: true })
4.6.7n/aNoneAll errors13 μs
21.44x
stat_minus_1
@railway-ts/pipelines
Code snippetCode snippet
validate(data, schema)
0.1.29n/aNoneAll errors16 μs
26.35x
stat_minus_1
@sapphire/shapeshift (run)
Code snippetCode snippet
schema.run(data)
5.0.0n/aNoneAll errors18 μs
30.91x
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 errors19 μs
31.36x
stat_minus_1
joi (no convert)
Code snippetCode snippet
schema.validate(data, { abortEarly: false, convert: false })
18.3.2n/aNoneAll errors34 μs
57.05x
stat_minus_1
joi
Code snippetCode snippet
schema.validate(data, { abortEarly: false })
18.3.2n/aNoneAll errors38 μs
63.55x
stat_minus_1
superstruct (schema.validate)
Code snippetCode snippet
const [error] = schema.validate(data);
for (const failure of error.failures()) {
  // ...
}
Returns the same objectReturns the same object
This library returned the same object when parsing, instead of creating a new object.
2.0.2n/aNoneAll errors51 μs
86.29x
stat_minus_2
superstruct
Code snippetCode snippet
const [error] = validate(data, schema);
for (const failure of error.failures()) {
  // ...
}
Returns the same objectReturns the same object
This library returned the same object when parsing, instead of creating a new object.
2.0.2n/aNoneAll errors51 μs
86.88x
stat_minus_2
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.
Returns the same objectReturns the same object
This library returned the same object when parsing, instead of creating a new object.
1.4.4n/aJITAll errors68 μs
115.42x
stat_minus_2
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.
Returns the same objectReturns the same object
This library returned the same object when parsing, instead of creating a new object.
1.4.4n/aJITAll errors69 μs
116.03x
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.
Returns the same objectReturns the same object
This library returned the same object when parsing, instead of creating a new object.
1.7.1n/aNoneAll errors112 μs
189.36x
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.
Returns the same objectReturns the same object
This library returned the same object when parsing, instead of creating a new object.
1.7.1n/aNoneAll errors139 μs
234.83x
stat_minus_3
Created by eskimojo for Open Circle

Preferences

Style
Theme
NPM browser
Code ligatures