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 new value.

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
@paseri/compiler (safeParse)
Code snippetCode snippet
schema.safeParse(data)
0.7.7123PrecompiledAll errors1 μs
@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.7123PrecompiledAll errors8 μs
5.74x
stat_minus_2
zod-compiler (compact)
Code snippetCode snippet
compactSchema.safeParse(data)
1.27.031.11KPrecompiledAll errors12 μs
8.23x
stat_minus_3
zod-compiler
Code snippetCode snippet
schema.safeParse(data)
1.27.031.11KPrecompiledAll errors16 μs
11.1x
stat_minus_3
zod-compiler (bag)
Code snippetCode snippet
bagSchema.safeParse(data)
1.27.031.11KPrecompiledAll errors17 μs
11.29x
stat_minus_3
typia (createValidate)
Code snippetCode snippet
// const validate = typia.createValidate<TypiaSchema>();
validate(data);

(Commented code is not benchmarked)

14.0.0271.05KPrecompiledAll errors17 μs
11.65x
stat_minus_3
typia (validate)
Code snippetCode snippet
typia.validate<TypiaSchema>(data)
14.0.0271.05KPrecompiledAll errors18 μs
12.32x
stat_minus_3
Created by eskimojo for Open Circle

Preferences

Style
Theme
NPM browser
Code ligatures