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.
Returns the same objectReturns the same object
This library returned the same object when parsing, instead of creating a new object.
0.7.7317PrecompiledAll errors1 μs
@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.7317PrecompiledAll errors1 μs
1.02x
stat_2
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.3.0n/aPrecompiledAll errors1 μs
1.32x
stat_minus_3
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.3.0n/aPrecompiledAll errors2 μs
1.64x
stat_minus_3
zod-compiler
Code snippetCode snippet
schema.safeParse(data)
2.0.8n/aPrecompiledAll errors1 μs
1.09x
stat_minus_2
zod-compiler (bag + mini)
Code snippetCode snippet
bagMiniSchema.safeParse(data)
2.0.8n/aPrecompiledAll errors1 μs
1.1x
stat_minus_3
zod-compiler (bag)
Code snippetCode snippet
bagSchema.safeParse(data)
2.0.8n/aPrecompiledAll errors1 μs
1.08x
stat_minus_2
zod-compiler (compact + mini)
Code snippetCode snippet
compactMiniSchema.safeParse(data)
2.0.8n/aPrecompiledAll errors1 μs
1.08x
stat_minus_2
zod-compiler (compact)
Code snippetCode snippet
compactSchema.safeParse(data)
2.0.8n/aPrecompiledAll errors1 μs
1.15x
stat_minus_3
zod-compiler (mini)
Code snippetCode snippet
miniSchema.safeParse(data)
2.0.8n/aPrecompiledAll errors1 μs
1.12x
stat_minus_3
Created by eskimojo for Open Circle

Preferences

Style
Theme
NPM browser
Code ligatures