Uh oh!
There was an error while loading. Please reload this page.
docs(coverage): ADR-009 xtrace tracing-engine spike - #859
Merged
Conversation
Spike #854: micro-benchmarked set -x -> BASH_XTRACEFD parsed offline vs the per-line DEBUG-trap callback. xtrace is ~6x cheaper per line on both bash 3.2 (+0.855s -> +0.127s) and bash 5 (+0.730s -> +0.131s), and a dedicated BASH_XTRACEFD keeps the trace out of test stdout/stderr while accurately reconstructing the covered-line set (taken vs not-taken arms). BASH_XTRACEFD is Bash 4.1+, so the recommendation is a hybrid engine — xtrace fast path on 4.1+, DEBUG-trap fallback on the Bash 3.0-4.0 floor — behind BASHUNIT_COVERAGE_ENGINE=auto|xtrace|trap. Reproducible benchmark committed. Confirms the #853 finding that trap dispatch, not I/O, is the cost. Closes#854
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 freeto 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.
🤔 Background
Related #854
Coverage is expensive because the
DEBUGtrap invokes a shell function per executed line; #853 showed that dedup barely moved wall time, proving the trap dispatch — not I/O — is the cost. This spike tested whetherset -x→BASH_XTRACEFDparsed offline is fundamentally cheaper.💡 Changes
BASH_XTRACEFDkeeps the trace out of test stdout/stderr and reconstructs the covered-line set accurately (taken vs not-taken arms).BASH_XTRACEFDis 4.1+), behindBASHUNIT_COVERAGE_ENGINE=auto|xtrace|trap. Implementation deferred to a follow-up.adrs/assets/.