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/Standard SchemaStandard Schema
github
GitHubGitHub
DiscordDiscord
PreferencesPreferences

Many libraries implement the Standard Schema interface, which allows many other libraries to accept them without needing to specialise for each library.

Copy to clipboardCopy to clipboard
import { personSchema } from "./schemas"; const person = await upfetch(url, { schema: personSchema, });
Copy to clipboardCopy to clipboard
import { personSchema } from "./schemas"; const person = await upfetch(url, { schema: personSchema });

We benchmark the time taken to parse using a standard schema.

infoInfo

Some libraries require an adapter before they can be used as a standard schema. The time to convert the schema is not measured, only the time to parse using it.

Data
  • errorInvalid
  • check_circleValid
Optimizations
  • flash_offNone
  • codeJIT
  • buildPrecompiled
Abort early
  • errorAll errors
  • warningAbort early
LibrarysortVersiondownload/wksortOptimizationsError typeMeanarrow_upwardCompare
ata-validator
Code snippetCode snippet
upfetch(url, { schema })
1.63.153.34KJITAll errors2 μs
sury
Code snippetCode snippet
upfetch(url, { schema })
11.1.0409.26KJITAll errors3 μs
1.28x
stat_minus_1
zod
Code snippetCode snippet
upfetch(url, { schema })
4.6.7454.84MJITAll errors9 μs
4.35x
stat_minus_1
zod (compile)
Code snippetCode snippet
const compiledSchema = z.compile(schema, { strict: true });
upfetch(url, { schema: compiledSchema })

(Setup code is not benchmarked)

4.6.7454.84MJITAll errors9 μs
4.38x
stat_minus_1
zod/mini
Code snippetCode snippet
upfetch(url, { schema })
4.6.7454.84MJITAll errors12 μs
6.07x
stat_minus_1
zod/mini (compile)
Code snippetCode snippet
const compiledSchema = z.compile(schema, { strict: true });
upfetch(url, { schema: compiledSchema })

(Setup code is not benchmarked)

4.6.7454.84MJITAll errors12 μs
6.3x
stat_minus_1
arktype
Code snippetCode snippet
upfetch(url, { schema })
2.2.92.87MJITAll errors55 μs
27.65x
stat_minus_3
Created by eskimojo for Open Circle

Preferences

Style
Theme
NPM browser
Code ligatures