Repository navigation
WIP: perf(executor): allocation-free trap-liveness probes (Refs #349) - #2372
Merged
Merged
Conversation
…obes (Refs #349) Every per-command / per-pipeline-stage / per-function-call site that asked "is trap X live?" through builtins::trap::get_trap_action paid for a TRAP_RESET BTreeSet build plus an action String clone (and a formatted key String) just to compute a boolean. Those sites now use the pre-existing allocation-free forms from the #1121/#375/#186 work: - active_trap_action_ref (borrowing, stack-buffer key, split-scan reset test; Some iff action present, non-empty, not reset) for the pure presence verdicts: ast_exec ERR sample, comsub errtrace / functrace-DEBUG gates, compound_exec EXIT gate, job_builtins signal-death checks, all pipeline_exec DEBUG-trap bail-outs, embedded_mutations DEBUG gate. - get_trap_action_fast (identical Option<String>, split-scan reset test, no BTreeSet) for the function_calls RETURN-trap save, which needs the action value itself. Semantics unchanged: reset-list signals read as unset, empty actions read as unset — identical to get_trap_action. Sites whose contract is presence-including-empty (external_inner EXIT/ERR spawn gate, limit_builtins ignore check) or that consume the action value (trap_exec firing machinery, job_builtins interrupt scan) deliberately keep get_trap_action. Ported from the d758fd0-based evidence branch fix/349-interp-perf (commit 0a3383f) by clean cherry-pick (zero conflicts, identical diffstat); all bench/probe/test evidence in the PR description was gathered on that twin tree.
Member
Author
|
Collector verification on this tree (Linux, this VM):
Full record: cluster REPORT.md (fix-349-interp-perf workdir). Draft stays draft. |
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.
WIP: perf(executor): allocation-free trap-liveness probes (Refs #349)
What
Every per-command / per-pipeline-stage / per-function-call site that asked
"is trap X live?" through
builtins::trap::get_trap_actionpaid for aTRAP_RESET BTreeSet build plus an action
Stringclone (and a formatted keyString) just to compute a boolean. Those sites now use the pre-existingallocation-free forms from the #1121/#375/#186 work:
active_trap_action_ref(borrowing, stack-buffer key, split-scan resettest;
Someiff action present, non-empty, not reset) for the purepresence verdicts: ast_exec ERR sample, comsub errtrace / functrace-DEBUG
gates, compound_exec EXIT gate, job_builtins signal-death checks, all
pipeline_exec DEBUG-trap bail-outs, embedded_mutations DEBUG gate.
get_trap_action_fast(identicalOption<String>, split-scan reset test,no BTreeSet) for the function_calls RETURN-trap save, which needs the
action value itself.
Semantics unchanged: reset-list signals read as unset, empty actions read as
unset — identical to
get_trap_action. Sites whose contract ispresence-including-empty (external_inner EXIT/ERR spawn gate, limit_builtins
ignore check) or that consume the action value (trap_exec firing machinery,
job_builtins interrupt scan) deliberately keep
get_trap_action.This is a mechanism-level change (how trap liveness is queried across the
whole executor), not a per-shape optimization.
Provenance
Ported from the d758fd0-based evidence branch
fix/349-interp-perf(commit 0a3383f) by clean cherry-pick: zero conflicts, diffstat and changed
lines identical (7 files, +37/−27). Bench evidence below was gathered on
that twin tree with the identical patch.
Bench (Linux, this 2-core VM, "fast" release profile: opt3, no LTO, 16 CGU)
Interleaved A/B (
bench_ab.py, 9 samples, medians, rusage CPU primary;every shape's stdout sha-verified identical between binaries, "out OK"):
Wall figures swing with the heavily loaded shared VM (load avg 4–16 during
runs); rusage CPU is the stable figure and improves on every shape. Two
independent runs agree on CPU direction and magnitude.
Verification
cargo check --lockedclean on this tree; rustfmt clean on alltouched files; lib + regression suite verdict in the cluster REPORT
(collector re-run on this tree; CI also runs its standard gates).
src/lexer/continuation.rschanges.Refs #349 (PERF-BASELINE interpreter-perf item). Draft — do not merge.