Skip to content

Effect Schema Runtime Performance - #6649

Draft
gcanti wants to merge 21 commits into
mainfrom
runtime-perf
Draft

Effect Schema Runtime Performance#6649
gcanti wants to merge 21 commits into
mainfrom
runtime-perf

Conversation

@gcanti

@gcanti gcanti commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

@coderabbitai ignore

Method

All results are median microseconds per operation (µs/op); lower is better
and the fastest value is bold.

Library Version API and mode
Effect 4.0.0-beta.102 SchemaParser.decodeUnknownExit (SchemaIssue)
Valibot 1.4.2 Pre-created safeParser
Zod 4.4.3 zod/v4 safeParse with jitless: true
TypeBox 1.3.7 Non-JIT Value.Errors

Effect main (0a532e503) and branch (c6edd1ebb) are paired five-process
medians. Competitor values use five processes, or nine for tagged unions.
Environment: Node v24.12.0, macOS arm64, Apple M3.

Successful parsing

Scenario Effect main Effect branch Valibot Zod 4 jitless TypeBox Value.Errors
Object, 1 field 0.132 µs 0.0907 µs 0.0317 µs 0.0241 µs 1.22 µs
Object, 32 fields 1.86 µs 1.47 µs 1.18 µs 1.52 µs 17.19 µs
Array, 32 elements 0.820 µs 0.336 µs 0.299 µs 0.279 µs 14.39 µs
Record, 1 entry 0.340 µs 0.0864 µs 0.0362 µs 0.134 µs 1.33 µs
Record, 32 entries 5.39 µs 1.11 µs 1.01 µs 3.09 µs 15.02 µs
Literal union, 100 members 2.01 µs 0.0351 µs 6.86 µs 3.30 µs 42.10 µs
Tagged union, 100 members 0.473 µs 0.241 µs 10.27 µs 0.248 µs 244.21 µs
Non-empty string 0.0549 µs 0.0245 µs 0.0355 µs 0.0368 µs 0.654 µs
Native five-part template literal 2.01 µs 0.693 µs 0.0423 µs
Application-shaped schema 2.12 µs 0.786 µs 0.570 µs 0.824 µs

Failed parsing

Scenario Effect main Effect branch Valibot Zod 4 jitless TypeBox Value.Errors
Object, 1 invalid field 1.46 µs 1.27 µs 0.0930 µs 7.05 µs 1.29 µs
Object 32, last field invalid 3.32 µs 2.52 µs 1.33 µs 9.08 µs 17.65 µs
Array 32, last element invalid 2.92 µs 2.49 µs 0.526 µs 7.27 µs 14.71 µs
Record 32, last entry invalid 5.31 µs 1.32 µs 1.22 µs 10.76 µs 15.20 µs
Literal union 100, invalid 1.95 µs 0.0783 µs 7.32 µs 80.42 µs 42.37 µs
Tagged union, selected member invalid 1.81 µs 1.50 µs 10.83 µs 7.49 µs 250.52 µs
Tagged union, unknown tag 0.142 µs 0.0841 µs 14.42 µs 17.98 µs 258.45 µs
Non-empty string, invalid 0.127 µs 0.0891 µs 0.0587 µs 6.61 µs 0.655 µs
Native five-part template literal, invalid number 1.33 µs 1.24 µs 7.50 µs

Cold paths

Scenario Effect main Effect branch Valibot Zod 4 jitless TypeBox Value.Errors
Construct a 32-field object schema 12.11 µs 12.04 µs 11.17 µs 155.50 µs 8.05 µs
Construct and perform the first decode 16.10 µs 15.78 µs 11.78 µs 184.32 µs 25.80 µs
Construct a record and decode 32 entries 11.83 µs 5.63 µs 1.80 µs 16.19 µs 18.94 µs
Construct a 100-member literal union and decode 426.19 µs 416.45 µs 45.05 µs 399.00 µs 57.60 µs
Construct a 100-member tagged union and decode 1,035.03 µs 901.72 µs 121.06 µs 2,612.27 µs 325.59 µs

Additional Effect paths

Scenario Effect main Effect branch
Template literal, valid 1.69 µs 0.489 µs
Five-part template literal parser, valid 1.72 µs 0.598 µs
Five-part template literal parser, invalid 0.682 µs 0.597 µs
Template literal parser with backtracking, valid 0.980 µs 0.424 µs
Template literal parser with backtracking, invalid 0.844 µs 0.706 µs
Transformed and checked template literal parser, valid 1.45 µs 0.446 µs
Record with 32 template-literal keys, valid 66.25 µs 17.24 µs
Construct a five-part template literal 22.98 µs 10.88 µs
Construct and first-decode a five-part template literal 26.14 µs 25.74 µs
Object with optional properties absent, valid 0.221 µs 0.169 µs
Object with optional properties present, valid 0.408 µs 0.217 µs
Object with an invalid optional property 7.23 µs 6.73 µs

Cost of Effect adapters

Effect API on invalid input Effect main Effect branch
SchemaParser.decodeUnknownExit 1.88 µs 1.57 µs
Schema.decodeUnknownOption 1.34 µs 1.23 µs
Schema.is 1.35 µs 1.27 µs
Schema.decodeUnknownResult 6.24 µs 6.38 µs
Schema.decodeUnknownExit 7.97 µs 7.83 µs
Schema.decodeUnknownSync 7.47 µs 7.18 µs

@github-project-automation github-project-automation Bot moved this to Discussion Ongoing in PR Backlog Jul 26, 2026
@changeset-bot

changeset-bot Bot commented Jul 26, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: c6edd1e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 28 packages
Name Type
effect Patch
@effect/opentelemetry Patch
@effect/platform-browser Patch
@effect/platform-bun Patch
@effect/platform-node-shared Patch
@effect/platform-node Patch
@effect/vitest Patch
@effect/ai-anthropic Patch
@effect/ai-openai-compat Patch
@effect/ai-openai Patch
@effect/ai-openrouter Patch
@effect/atom-react Patch
@effect/atom-solid Patch
@effect/atom-vue Patch
@effect/sql-clickhouse Patch
@effect/sql-d1 Patch
@effect/sql-libsql Patch
@effect/sql-mssql Patch
@effect/sql-mysql2 Patch
@effect/sql-pg Patch
@effect/sql-pglite Patch
@effect/sql-sqlite-bun Patch
@effect/sql-sqlite-do Patch
@effect/sql-sqlite-node Patch
@effect/sql-sqlite-react-native Patch
@effect/sql-sqlite-wasm Patch
@effect/docgen Patch
@effect/openapi-generator Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@effect-slopcop effect-slopcop Bot added 4.0 enhancement New feature or request labels Jul 26, 2026
@github-actions

github-actions Bot commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

Bundle Size Analysis

File Name Current Size Previous Size Difference
basic.ts 6.63 KB 6.63 KB 0.00 KB (0.00%)
batching.ts 9.43 KB 9.37 KB +0.06 KB (+0.60%)
brand.ts 6.28 KB 6.26 KB +0.02 KB (+0.34%)
cache.ts 10.12 KB 10.12 KB 0.00 KB (0.00%)
config.ts 19.79 KB 19.22 KB +0.58 KB (+3.00%)
differ.ts 18.96 KB 18.42 KB +0.54 KB (+2.93%)
http-client.ts 20.83 KB 20.76 KB +0.07 KB (+0.35%)
logger.ts 10.28 KB 10.28 KB 0.00 KB (0.00%)
metric.ts 8.55 KB 8.55 KB 0.00 KB (0.00%)
optic.ts 7.43 KB 7.41 KB +0.02 KB (+0.32%)
pubsub.ts 14.27 KB 14.20 KB +0.07 KB (+0.46%)
queue.ts 11.09 KB 11.09 KB 0.00 KB (0.00%)
schedule.ts 10.27 KB 10.27 KB 0.00 KB (0.00%)
schema-class.ts 18.71 KB 18.16 KB +0.55 KB (+3.01%)
schema-fromJsonSchemaDocument.ts 28.68 KB 28.02 KB +0.66 KB (+2.36%)
schema-representation-roundtrip.ts 24.98 KB 24.34 KB +0.65 KB (+2.65%)
schema-string-transformation.ts 12.95 KB 12.69 KB +0.26 KB (+2.08%)
schema-string.ts 10.65 KB 10.35 KB +0.30 KB (+2.87%)
schema-template-literal.ts 14.86 KB 14.49 KB +0.37 KB (+2.56%)
schema-toArbitraryLazy.ts 21.53 KB 20.93 KB +0.59 KB (+2.84%)
schema-toCodeDocument.ts 23.97 KB 23.38 KB +0.59 KB (+2.52%)
schema-toCodecJson.ts 18.87 KB 18.32 KB +0.55 KB (+3.02%)
schema-toEquivalence.ts 18.59 KB 18.00 KB +0.58 KB (+3.24%)
schema-toFormatter.ts 18.45 KB 17.88 KB +0.57 KB (+3.19%)
schema-toJsonSchemaDocument.ts 22.07 KB 21.52 KB +0.55 KB (+2.56%)
schema-toRepresentation.ts 19.14 KB 18.56 KB +0.58 KB (+3.13%)
schema.ts 18.00 KB 17.43 KB +0.57 KB (+3.27%)
stm.ts 12.05 KB 12.05 KB 0.00 KB (0.00%)
stream.ts 9.37 KB 9.37 KB 0.00 KB (0.00%)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

4.0 enhancement New feature or request

Projects

Status: Discussion Ongoing

Development

Successfully merging this pull request may close these issues.

1 participant