LogoLogo

Schema Benchmarks

    • home
      Home

    • download_2
      Download
    • timer
      Initialization
    • check_circle
      Validation
    • output_circle
      Parsing
    • schema
      Standard Schema
    • format_quote
      String

    • article
      Blog
Code styleCode style
Normal styleNormal style
System themeSystem theme
Light themeLight theme
Dark themeDark theme
Expand sidebarExpand sidebar
Benchmarks/Standard SchemaStandard Schema
Code styleCode style
Normal styleNormal style
System themeSystem theme
Light themeLight theme
Dark themeDark theme
github
GitHubGitHub
DiscordDiscord

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

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
errorInvalidcheck_circleValid
Optimizations
flash_offNonecodeJITbuildPrecompiled
Abort early
errorAll errorswarningAbort early
LibrarysortVersionDownloads (/wk)sortOptimizationsError typeMeanarrow_upwardCompare
joi
Code snippet
upfetch(url, { schema })
18.0.217MNoneAll errors5 μs
effect
Code snippet
// const standardSchema = Schema.standardSchemaV1(
//   schema, 
//   { errors: "first" }
// );
upfetch(url, { schema: standardSchema });

(Commented code is not benchmarked)

3.19.198.1MNoneAbort early5 μs
1.11x
stat_minus_1
sury
Code snippet
upfetch(url, { schema })
11.0.0-alpha.488KJITAll errors8 μs
1.7x
stat_minus_1
typia
Code snippet
// const validate = typia.createValidate<TypiaSchema>();
upfetch(url, { schema: validate })

(Commented code is not benchmarked)

11.0.3233KPrecompiledAll errors10 μs
2.3x
stat_minus_1
valibot
Code snippet
upfetch(url, { schema })
1.2.06.4MNoneAll errors27 μs
6x
stat_minus_1
effect@beta
Code snippet
// const standardSchema = Schema.toStandardSchemaV1(
//   schema, 
//   { parseOptions: { errors: "all" } }
// );
upfetch(url, { schema: standardSchema });

(Commented code is not benchmarked)

4.0.0-beta.58.1MNoneAll errors29 μs
6.25x
stat_minus_1
effect@beta
Code snippet
// const standardSchema = Schema.toStandardSchemaV1(
//   schema, 
//   { parseOptions: { errors: "first" } }
// );
upfetch(url, { schema: standardSchema });

(Commented code is not benchmarked)

4.0.0-beta.58.1MNoneAbort early29 μs
6.25x
stat_minus_1
@railway-ts/pipelines
Code snippet
upfetch(url, { schema })
0.1.25823NoneAll errors29 μs
6.38x
stat_minus_1
zod
Code snippet
upfetch(url, { schema })
4.3.6100MJITAll errors62 μs
13.62x
stat_minus_1
zod/mini
Code snippet
upfetch(url, { schema })
4.3.6100MJITAll errors62 μs
13.69x
stat_minus_1
effect
Code snippet
// const standardSchema = Schema.standardSchemaV1(
//   schema, 
//   { errors: "all" }
// );
upfetch(url, { schema: standardSchema });

(Commented code is not benchmarked)

3.19.198.1MNoneAll errors70 μs
15.34x
stat_minus_1
arktype
Code snippet
upfetch(url, { schema })
2.1.29739KJITAll errors90 μs
19.72x
stat_minus_1
yup
Code snippet
upfetch(url, { schema })
1.7.19.8MNoneAll errors490 μs
107.29x
stat_minus_3
Created by eskimojo for Open Circle