Repository navigation
Conversation
eamsden
force-pushed
the
eamsden/defer-promise-stack-formatting
branch
from
October 14, 2026 23:12
387be75 to
e08d67d
Compare
Contributor
Author
|
Issue #1587 (live Workflow execution): A local comparison of
The sync-helper control’s change is within measured noise. (Five warmups and 30 paired measurements per workflow and variant; Node v24.19.0, Apple M5 Max, local Server 1.31.0, identical release Core and Workflow bundle, and ordinary Workflow worker threads with stack diagnostics enabled. This result is specific to the tight async-loop workload.) |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What was changed
Capture raw V8 call sites when a Workflow Promise is created and defer source-map lookup and stack formatting unless and until the stack is actually queried. Cache the formatted and structured results together, and keep Promise aggregation relationships tracked from raw call sites. A WeakSet marks individual capture errors so VM timeouts cannot leave a global formatting mode active and corrupt later error stacks.
Why?
Most replay promises settle without a stack query. Deferring source-map lookup and formatting removes repeated work from activation processing while retaining diagnostic detail.
Benchmark results
These are prior measurements of the standalone deferred-formatting variant against main at
f2b6b0fe, using main's pinned Core revision2deeab98d64a6bc1fac4eab5a942e7889acf8077in a release build (opt-level 3, LTO), with Core chunking retained. The measured variant includes deferred formatting alone. This PR is based on a newer main revision.Single-history replay:
Worker.runReplayHistoryReplay worker reused across ten histories:
Worker.runReplayHistoriesTimes below are the whole API call divided by ten; percentage savings are calculated from the whole call.
(See below for methodology)
Checklist
How was this tested:
REUSE_V8_CONTEXT=false; both diagnostic query formats are covered in both VM modes.Worker.runReplayHistoriesreplays (ten histories per synthetic workload) against a release build of main's pinned Core, asserting the expected chunked activation counts, signal counts, eviction counts, and successful replay results.Any docs updates needed?
Added an entry under
Unreleased→ChangedinCHANGELOG.md; the public API and diagnostic output are preserved.Benchmark Methodology
Medians of nine runs after two warmups, rotating variant order, sequential calls, and a separate persistent Node process per variant. Intervals use a paired bootstrap with 5,000 resamples. Timing covers the whole public replay API, including worker/Core setup, history encoding/decoding, VM creation, activation processing, eviction, and shutdown; initial workflow bundling and history file loading are excluded. Configuration: Node v24.19.0 on Darwin arm64, public replay defaults,
reuseV8Context: true, prebuilt bundles, default data converter, and error-only logging.Each synthetic history has 1,000 intervening Workflow Tasks. Empty has no progress signals, sparse has ten, and the other workloads have 1,000. Progress handlers perform two
await Promise.resolve()calls. Core produces 2, 12, 1,002, 4, and 4 language activations respectively; replay results, activation counts, signal counts, and evictions are asserted. These results describe these synthetic workloads and do not establish a universal production speedup.