Repository navigation
perf(warp-core): run a single execution worker on the calling thread - #932
flyingrobots wants to merge 3 commits into
Conversation
execute_work_queue spawned and joined a scoped thread even when it had one worker, and the engine's default is one worker. On F5 tier M under the application-root profile, spawning and joining that thread took about 31% of each tick, while the work it ran was about 2% of the run. A single worker now runs the same loop inline. Several workers still each get a thread. Nothing it computes changes. Carried onto main from 43a8ddd on claude/stack-envelope, as an isolated candidate with no dependency on M1, M2 or lazy blockers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add two witnesses that a single worker running inline on the caller's thread reports failures exactly as scoped worker threads do: - rule_panic_propagates_identically_for_every_worker_count: one of twenty scopes panics in its executor; for workers 1, 2, 4, 8, 16, 32 the commit unwinds with the executor's payload, retains no evidence, keeps the poisoned item's evidence as a failure artifact, and leaves the state root unchanged. - missing_store_propagates_identically_for_every_worker_count: an unresolvable warp yields exactly one MissingStore for 1, 2, 4, 8 workers, every other worker an empty success. Both pass with the inline path and with it disabled (the old threaded one-worker path), and both fail against a mutant whose inline path swallows failures. Document on execute_work_queue, EngineBuilder::workers and in the changelog that with one worker rules run on the caller's thread and stack, so native rules must not rely on a fresh thread-local environment per tick. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
clippy::manual_assert rejected an if-then panic! in the new engine witness. assert! with a literal message keeps the same &str payload. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 1 minute. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Summary
drain_units, which both paths share.CHANGELOG.md: with one worker, rules run on the caller's thread and stack, so native rules must not rely on a fresh thread-local environment per tick.Scope
Links
docs/studies/stack-on-main.mdon branchclaude/measure-stack) and its review, which approved it as an isolated change.Evidence
F5 tier M, application profile, append p50: 260.08 ms on
mainplus benches, 167.86 ms with this change. The run used a revision whose patch is identical tod578e157(git patch-id), with durability off. Source:docs/studies/stack-on-main/summary.mdonclaude/measure-stack.Below 1 ms (100-rewrite ticks) the runs disagreed with themselves, including on a path this change does not touch, so those rows are treated as noise.
Error-propagation witnesses:
rule_panic_propagates_identically_for_every_worker_count(1 to 32 workers), intests/parallel_engine_worker_invariance.rs;missing_store_propagates_identically_for_every_worker_count, inparallel/exec.rs.Both pass on the old one-thread path and on this change. Both fail against a deliberately broken inline path that swallows failures. They guard behaviour, so there was no red-before.
Checks on
c82a23cd, local, Rust 1.96, macOS:ban-globalspass.warp-coresuite (native_rule_bootstrap,trusted_runtime,host_test,delta_validate,application_root_profile,det_fixed) has 2,057 passed and 1 failed,special_files_are_rejected_before_a_read_attempt. That test binds a Unix socket under a scratch path longer thanSUN_LEN. Rerun from a shortTMPDIR, its whole target passes, 27 of 27.Canonical results: golden vectors GV-001 to GV-004 and the existing worker-invariance tests pass.
Known, not changed here
EngineBuilder::workerssays workers are capped atNUM_SHARDS. The engine actually caps them at the number of work units.Documentation gate
CHANGELOG.mdentry in this PR.Checklist
🤖 Generated with Claude Code