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
effect
Code snippetCode snippet
const standardSchema = Schema.toStandardSchemaV1(schema, { parseOptions: { errors: "first" } });
upfetch(url, { schema: standardSchema });

(Setup code is not benchmarked)

4.1.2n/aNoneAbort early1 μs
joi
Code snippetCode snippet
upfetch(url, { schema })
18.3.2n/aNoneAll errors3 μs
1.84x
stat_minus_1
@paseri/paseri
Code snippetCode snippet
upfetch(url, { schema })
1.9.7520NoneAll errors4 μs
2.7x
stat_minus_1
valibot
Code snippetCode snippet
upfetch(url, { schema })
1.5.0n/aNoneAll errors6 μs
4.62x
stat_minus_1
@remix-run/data-schema
Code snippetCode snippet
upfetch(url, { schema })
1.0.0n/aNoneAll errors7 μs
5.22x
stat_minus_1
@railway-ts/pipelines
Code snippetCode snippet
upfetch(url, { schema })
0.1.29n/aNoneAll errors13 μs
9.06x
stat_minus_1
effect
Code snippetCode snippet
const standardSchema = Schema.toStandardSchemaV1(
  schema,
  { parseOptions: { errors: "all" } }
);
upfetch(url, { schema: standardSchema });

(Setup code is not benchmarked)

4.1.2n/aNoneAll errors14 μs
9.8x
stat_minus_1
zod/v3
Code snippetCode snippet
upfetch(url, { schema })
4.6.7n/aNoneAll errors15 μs
10.92x
stat_minus_1
decoders
Code snippetCode snippet
upfetch(url, { schema })
2.13.0n/aNoneAll errors76 μs
54x
stat_minus_2
yup
Code snippetCode snippet
upfetch(url, { schema })
1.7.1n/aNoneAll errors208 μs
148.06x
stat_minus_3
Created by eskimojo for Open Circle

Preferences

Style
Theme
NPM browser
Code ligatures