Files
vercel__workflow/workbench/inline-step-bench/package.json
vercel[bot] 448ee394c5 [benchmarks] Add local inline-step STSO benchmark
Measures step-to-step overhead for steps that run eagerly inline — many
sequential steps inside a single flow-handler invocation, no queue hop.
Runs against @workflow/world-local, so it needs no deployment (unlike
packages/core/e2e/benchmark.test.ts).

Findings at 1000 null steps (see RESULTS-1000.txt):

- The in-process loop re-executes the workflow function once per step:
  1000 steps => 1 flow invocation, 1001 replays, 3 events/step in the log.
- STSO(i) ~= 7.3 ms + 0.074 ms * i. First few steps ~8 ms, step 1000
  ~80 ms (~10x). Total is quadratic: 44 s, of which 35 s is replay and
  ~1 ms is step-body work.
- Replay overtakes world I/O around step 15-20 and is ~80% of the gap
  past step 300.

A step's return value doubles the slope, but not because of its size
(RESULTS-payload-600.txt). ReplayPayloadCache memoizes the hydrated value
only for primitives <= MAX_MEMOIZED_PRIMITIVE_LENGTH; everything else
re-hydrates against each fresh VM realm. So a 4000-char string costs the
same as returning nothing (0.028 ms/step) while a 5000-char string costs
0.074, and a 40-byte object costs the same as a 5 KB string. 15x the
object payload moves the slope 7% — the penalty is mostly the
per-hydration reviver-table construction, not decoding.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Signed-off-by: Shalabh Chaturvedi <7066873+shalabhc@users.noreply.github.com>

Co-Authored-By: Shalabh Chaturvedi <7066873+shalabhc@users.noreply.github.com>
2026-07-30 21:52:15 +00:00

26 lines
718 B
JSON

{
"name": "@workflow/inline-step-bench",
"private": true,
"type": "module",
"version": "0.0.0",
"license": "Apache-2.0",
"description": "Local benchmark for step-to-step overhead of eagerly-inlined steps (single invocation, no queue hop)",
"scripts": {
"build": "wf build",
"bench": "node bench.mjs",
"clean": "rm -rf .well-known .workflow-data .swc results"
},
"dependencies": {
"@hono/node-server": "1.19.13",
"@workflow/cli": "workspace:*",
"@workflow/core": "workspace:*",
"@workflow/world": "workspace:*",
"@workflow/world-local": "workspace:*",
"hono": "4.12.25",
"workflow": "workspace:*"
},
"devDependencies": {
"@types/node": "catalog:"
}
}