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.7317PrecompiledAll errors5 μs
@paseri/compiler (safeParse)
Code snippetCode snippet
schema.safeParse(data)
0.7.7317PrecompiledAll errors1 μs
3.39x
stat_1
typia (createValidate)
Code snippetCode snippet
const validate = typia.createValidate<TypiaSchema>();
validate(data);

(Setup code is not benchmarked)

15.3.0513.85KPrecompiledAll errors12 μs
2.44x
stat_minus_1
typia (validate)
Code snippetCode snippet
typia.validate<TypiaSchema>(data)
15.3.0513.85KPrecompiledAll errors12 μs
2.41x
stat_minus_1
zod-compiler
Code snippetCode snippet
schema.safeParse(data)
2.0.8140.11KPrecompiledAll errors61 ns
81.12x
stat_3
zod-compiler (bag + mini)
Code snippetCode snippet
bagMiniSchema.safeParse(data)
2.0.8140.11KPrecompiledAll errors61 ns
81.23x
stat_3
zod-compiler (bag)
Code snippetCode snippet
bagSchema.safeParse(data)
2.0.8140.11KPrecompiledAll errors61 ns
81.09x
stat_3
zod-compiler (compact + mini)
Code snippetCode snippet
compactMiniSchema.safeParse(data)
2.0.8140.11KPrecompiledAll errors62 ns
79.33x
stat_3
zod-compiler (compact)
Code snippetCode snippet
compactSchema.safeParse(data)
2.0.8140.11KPrecompiledAll errors61 ns
80.48x
stat_3
zod-compiler (mini)
Code snippetCode snippet
miniSchema.safeParse(data)
2.0.8140.11KPrecompiledAll errors60 ns
82.02x
stat_3
Created by eskimojo for Open Circle

Preferences

Style
Theme
NPM browser
Code ligatures