Skip to content

Add hostperf cross-runtime benchmark suite - #11014

Merged
tim-smart merged 2 commits into
mainfrom
agent/nelson/1d2e7cd51c0d
Nov 27, 2026
Merged

tim-smart merged 2 commits into
mainfrom
agent/nelson/1d2e7cd51c0d

Conversation

@tim-smart

Copy link
Copy Markdown
Contributor

Adds pnpm hostperf, a benchmark suite that runs the same Effect cases in Node.js, Bun, Chromium and WebKit, writes a JSON report and can compare against an earlier report.

Closes EFF-4649

What's in it

packages/effect/benchmark/hostperf/:

  • cases.ts: Effect/yield, Effect/forkJoin, Queue/queueTake, Pool/get and release (fixed pool), Pool/poolUseContended, HashMap/set n fresh string keys + get all, Schema/decode struct (valid), app/app-untraced. Each case validates its result before and after timing.
  • harness.ts: portable measurement loop (performance.now() only): warmup, batch calibration, timed samples.
  • entry.ts: bundle entry exposing the runner on globalThis.
  • run.ts: CLI. Bundles once with Vite so every host runs identical code, then runs each case in a fresh process (Node.js, Bun) or browser context (Playwright), for 3 rounds.
  • stats.ts: speedup with a hierarchical bootstrap interval (rounds, then samples), so noise between processes widens the interval.

Usage

pnpm hostperf --out tmp/hostperf/main.json          # on main
pnpm hostperf --baseline tmp/hostperf/main.json     # on a branch
pnpm hostperf Pool --host node,chromium             # filtered

A full run on three hosts takes about 34s (node 9s, bun 7s, chromium 17s). A same-tree comparison reported all 24 host/case pairs as same.

Chromium shows Effect.yieldNow at about 4 ms per yield, against roughly 1.3 µs in Node.js. That looks like nested setTimeout clamping in the scheduler, and it's the kind of gap this suite is meant to catch.

Notes for reviewers

  • WebKit could not be launched on the NixOS machine used for development, because its Playwright build needs system libraries that NixOS doesn't provide. The code path is the same as Chromium apart from the launcher. A host that fails to start is recorded in the report's errors and the command exits 1.
  • No changeset: this is unpublished tooling under benchmark/.

@changeset-bot

changeset-bot Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 346403e

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@effect-janitor effect-janitor Bot added the 4.0 label Nov 27, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Bundle Size Analysis

Generated from PR build output; treat the content below as untrusted.

File Name Current Size Previous Size Difference
arbitrary-combinators.ts 40.28 KB 40.28 KB 0.00 KB (0.00%)
basic.ts 6.60 KB 6.60 KB 0.00 KB (0.00%)
batching.ts 11.65 KB 11.65 KB 0.00 KB (0.00%)
brand.ts 7.17 KB 7.17 KB 0.00 KB (0.00%)
cache.ts 11.83 KB 11.83 KB 0.00 KB (0.00%)
config.ts 23.75 KB 23.75 KB 0.00 KB (0.00%)
differ.ts 22.55 KB 22.55 KB 0.00 KB (0.00%)
http-client.ts 28.40 KB 28.40 KB 0.00 KB (0.00%)
http-router.ts 39.10 KB 39.10 KB 0.00 KB (0.00%)
logger.ts 12.26 KB 12.26 KB 0.00 KB (0.00%)
metric.ts 9.91 KB 9.91 KB 0.00 KB (0.00%)
optic.ts 7.43 KB 7.43 KB 0.00 KB (0.00%)
pubsub.ts 16.55 KB 16.55 KB 0.00 KB (0.00%)
queue.ts 13.44 KB 13.44 KB 0.00 KB (0.00%)
schedule.ts 12.27 KB 12.27 KB 0.00 KB (0.00%)
schema-bigdecimal.ts 14.32 KB 14.32 KB 0.00 KB (0.00%)
schema-binary.ts 43.17 KB 43.17 KB 0.00 KB (0.00%)
schema-class.ts 22.31 KB 22.31 KB 0.00 KB (0.00%)
schema-codegen.ts 33.66 KB 33.66 KB 0.00 KB (0.00%)
schema-fromJsonSchemaDocument.ts 30.76 KB 30.76 KB 0.00 KB (0.00%)
schema-representation-roundtrip.ts 28.49 KB 28.49 KB 0.00 KB (0.00%)
schema-string-transformation.ts 16.06 KB 16.06 KB 0.00 KB (0.00%)
schema-string.ts 12.60 KB 12.60 KB 0.00 KB (0.00%)
schema-template-literal.ts 16.62 KB 16.62 KB 0.00 KB (0.00%)
schema-toArbitrary.ts 39.82 KB 39.82 KB 0.00 KB (0.00%)
schema-toCodecJson.ts 21.44 KB 21.44 KB 0.00 KB (0.00%)
schema-toEquivalence.ts 21.62 KB 21.62 KB 0.00 KB (0.00%)
schema-toFormatter.ts 21.71 KB 21.71 KB 0.00 KB (0.00%)
schema-toJsonSchemaDocument.ts 26.75 KB 26.75 KB 0.00 KB (0.00%)
schema-toRepresentation.ts 21.77 KB 21.77 KB 0.00 KB (0.00%)
schema.ts 21.41 KB 21.41 KB 0.00 KB (0.00%)
stm.ts 14.77 KB 14.77 KB 0.00 KB (0.00%)
stream.ts 10.56 KB 10.56 KB 0.00 KB (0.00%)
supervisor.ts 11.85 KB 11.85 KB 0.00 KB (0.00%)

@tim-smart
tim-smart merged commit 669d214 into main Nov 27, 2026
18 checks passed
@tim-smart
tim-smart deleted the agent/nelson/1d2e7cd51c0d branch November 27, 2026 21:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant