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/wkarrow_upwardOptimizationsError typeMeansortCompare
zod
Code snippetCode snippet
schema.safeParse(data)
4.6.5209.22MJITAll errors6 μs
zod (compile)
Code snippetCode snippet
compiledSchema.safeParse(data)
4.6.5209.22MJITAll errors1 μs
5.18x
stat_1
zod (jitless)
Code snippetCode snippet
schema.safeParse(data, { jitless: true })
4.6.5209.22MNoneAll errors13 μs
2.14x
stat_minus_1
zod/mini
Code snippetCode snippet
schema.safeParse(data)
4.6.5209.22MJITAll errors12 μs
2.03x
stat_minus_1
zod/mini (compile)
Code snippetCode snippet
compiledSchema.safeParse(data)
4.6.5209.22MJITAll errors1 μs
5.04x
stat_1
zod/mini (jitless)
Code snippetCode snippet
schema.safeParse(data, { jitless: true })
4.6.5209.22MNoneAll errors12 μs
2.02x
stat_minus_1
zod/v3
Code snippetCode snippet
schema.safeParse(data)
4.6.5209.22MNoneAll errors13 μs
2.11x
stat_minus_1
effect
Code snippetCode snippet
const decodeFirst = Schema.decodeUnknownEither(schema, { errors: "first" });
decodeFirst(data)

(Setup code is not benchmarked)

3.22.224.53MNoneAbort early16 μs
2.73x
stat_minus_1
effect
Code snippetCode snippet
const decodeAll = Schema.decodeUnknownEither(schema, { errors: "all" });
decodeAll(data)

(Setup code is not benchmarked)

3.22.224.53MNoneAll errors16 μs
2.75x
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.11224.53MNoneAbort early9 μs
1.58x
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.11224.53MNoneAll errors11 μs
1.81x
stat_minus_1
joi
Code snippetCode snippet
schema.validate(data, { abortEarly: true })
18.2.919.7MNoneAbort early37 μs
6.26x
stat_minus_1
joi
Code snippetCode snippet
schema.validate(data, { abortEarly: false })
18.2.919.7MNoneAll errors37 μs
6.29x
stat_minus_1
joi (no convert)
Code snippetCode snippet
schema.validate(data, { abortEarly: true, convert: false })
18.2.919.7MNoneAbort early33 μs
5.55x
stat_minus_1
joi (no convert)
Code snippetCode snippet
schema.validate(data, { abortEarly: false, convert: false })
18.2.919.7MNoneAll errors33 μs
5.59x
stat_minus_1
valibot
Code snippetCode snippet
v.safeParse(schema, data)
1.5.013.99MNoneAll errors7 μs
1.18x
stat_minus_1
valibot
Code snippetCode snippet
v.safeParse(schema, data, { abortEarly: true })
1.5.013.99MNoneAbort early7 μs
1.18x
stat_minus_1
valibot (abortPipeEarly only)
Code snippetCode snippet
v.safeParse(schema, data, { abortPipeEarly: true })
1.5.013.99MNoneAbort early7 μs
1.18x
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.
Returns the same objectReturns the same object
This library returned the same object when parsing, instead of creating a new object.
1.3.309.44MJITAll errors71 μs
11.9x
stat_minus_2
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.3.309.44MJITAll errors1 μs
5.33x
stat_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.3.309.44MJITAll errors1 μs
5.5x
stat_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.
Returns the same objectReturns the same object
This library returned the same object when parsing, instead of creating a new object.
1.3.309.44MJITAll errors71 μs
11.92x
stat_minus_2
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.3.309.44MJITAll errors1 μs
5.55x
stat_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.
Returns the same objectReturns the same object
This library returned the same object when parsing, instead of creating a new object.
1.7.18.58MNoneAbort early139 μs
23.33x
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.18.58MNoneAll errors141 μs
23.81x
stat_minus_3
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.
Returns the same objectReturns the same object
This library returned the same object when parsing, instead of creating a new object.
1.7.18.58MNoneAbort early113 μs
19.11x
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.
Returns the same objectReturns the same object
This library returned the same object when parsing, instead of creating a new object.
1.7.18.58MNoneAll errors114 μs
19.21x
stat_minus_3
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.24.73MNoneAll errors51 μs
8.67x
stat_minus_2
superstruct
Code snippetCode snippet
validate(data, schema)
Returns the same objectReturns the same object
This library returned the same object when parsing, instead of creating a new object.
2.0.24.73MNoneAbort early52 μs
8.69x
stat_minus_2
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.24.73MNoneAll errors51 μs
8.57x
stat_minus_2
superstruct (schema.validate)
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.
2.0.24.73MNoneAbort early51 μs
8.6x
stat_minus_2
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.221.94MNoneAll errors5 μs
1.28x
stat_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.31.48MJITAll errors8 μs
1.31x
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.01.01MNoneAll errors19 μs
3.14x
stat_minus_1
@sapphire/shapeshift (run)
Code snippetCode snippet
schema.run(data)
5.0.01.01MNoneAll errors18 μs
3.07x
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.0333.97KJITAll errors2 μs
3.55x
stat_1
sury (asResult + compiled)
Code snippetCode snippet
const parseAsResult = S.parseAsResult(S.schema(value));
parseAsResult(data);

(Setup code is not benchmarked)

11.0.0333.97KJITAll errors1 μs
4.04x
stat_1
sury (asResult)
Code snippetCode snippet
S.parseAsResult(schema, data)
11.0.0333.97KJITAll errors2 μs
3.71x
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.0.0333.97KJITAll errors2 μs
3.9x
stat_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.
14.0.6242.17KPrecompiledAll errors7 μs
1.1x
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.
14.0.6242.17KPrecompiledAll errors7 μs
1.18x
stat_minus_1
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.5187.42KNoneAbort early73 μs
12.29x
stat_minus_2
runtypes (inspect)
Code snippetCode snippet
schema.inspect(data)
7.0.5187.42KNoneAbort early71 μs
11.92x
stat_minus_2
zod-compiler
Code snippetCode snippet
schema.safeParse(data)
2.0.457.98KPrecompiledAll errors4 μs
1.67x
stat_1
zod-compiler (bag)
Code snippetCode snippet
bagSchema.safeParse(data)
2.0.457.98KPrecompiledAll errors4 μs
1.66x
stat_1
zod-compiler (compact)
Code snippetCode snippet
compactSchema.safeParse(data)
2.0.457.98KPrecompiledAll errors2 μs
2.8x
stat_1
decoders
Code snippetCode snippet
schema.decode(data)
2.9.320.6KNoneAll errors16 μs
2.69x
stat_minus_1
@remix-run/data-schema
Code snippetCode snippet
parseSafe(schema, data)
0.3.03.51KNoneAll errors9 μs
1.46x
stat_minus_1
@remix-run/data-schema
Code snippetCode snippet
parseSafe(schema, data, { abortEarly: true })
0.3.03.51KNoneAbort early9 μs
1.55x
stat_minus_1
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.21.02.75KJITAll errors2 μs
3.79x
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.
Returns the same objectReturns the same object
This library returned the same object when parsing, instead of creating a new object.
1.9.7136NoneAll errors3 μs
1.83x
stat_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.7136NoneAll errors3 μs
1.83x
stat_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.7110PrecompiledAll errors1 μs
5.66x
stat_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.7110PrecompiledAll errors1 μs
5.86x
stat_1
@railway-ts/pipelines
Code snippetCode snippet
validate(data, schema, { abortEarly: true })
0.1.2999NoneAbort early16 μs
2.63x
stat_minus_1
@railway-ts/pipelines
Code snippetCode snippet
validate(data, schema)
0.1.2999NoneAll errors16 μs
2.66x
stat_minus_1
Created by eskimojo for Open Circle

Preferences

Style
Theme
NPM browser
Code ligatures