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

(Setup code is not benchmarked)

15.1.0n/aPrecompiledAll errors11 μs
3x
stat_minus_1
typia (validate)
Code snippetCode snippet
typia.validate<TypiaSchema>(data)
15.1.0n/aPrecompiledAll errors12 μs
3.21x
stat_minus_1
zod-compiler
Code snippetCode snippet
schema.safeParse(data)
2.0.7n/aPrecompiledAll errors48 ns
76x
stat_3
zod-compiler (bag)
Code snippetCode snippet
bagSchema.safeParse(data)
2.0.7n/aPrecompiledAll errors48 ns
75.49x
stat_3
zod-compiler (compact)
Code snippetCode snippet
compactSchema.safeParse(data)
2.0.7n/aPrecompiledAll errors48 ns
75.99x
stat_3
Created by eskimojo for Open Circle

Preferences

Style
Theme
NPM browser
Code ligatures