perf(runner): cache coverage-enabled flag in hot path#670
Merged
Conversation
Resolve BASHUNIT_COVERAGE into _BASHUNIT_COVERAGE_ON once per run via bashunit::runner::sync_coverage_flag; replace 9 hot-path call sites in runner.sh with a direct "= 1" string compare instead of a function dispatch. The public bashunit::env::is_coverage_enabled is unchanged so tests that toggle BASHUNIT_COVERAGE mid-run keep working. Closes #664
59de045 to
67d3814
Compare
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.
Summary
bashunit::runner::sync_coverage_flagthat resolvesBASHUNIT_COVERAGEinto_BASHUNIT_COVERAGE_ON(1|0) once per run.bashunit::env::is_coverage_enabledinsrc/runner.shwith a direct[ "$_BASHUNIT_COVERAGE_ON" = 1 ]check — no function dispatch.bashunit::env::is_coverage_enabledis unchanged, so coverage unit tests that toggleBASHUNIT_COVERAGEmid-run keep working.Test plan
test_sync_coverage_flag_sets_one_when_enabled,..._zero_when_disabled,..._zero_when_unsetintests/unit/runner_test.sh./bashunit tests/unit/green (817 passed)./bashunit --parallel tests/green (1052 passed)make sacleanmake lintcleanCloses #664