perf(runner): auto-skip per-test timing when the clock forks an interpreter#769
Merged
Conversation
…preter (#765) Default BASHUNIT_SHOW_EXECUTION_TIME to `auto`: measure per-test duration only when a consumer needs it (--profile, --verbose, a report, or an explicit execution-time display). On shells whose clock forks an interpreter (Bash 3.2 macOS -> perl), a plain run now skips both clock reads, removing ~2 perl forks per test. - clock::is_expensive classifies the resolved impl (perl/python/node/ powershell = expensive) - env::is_show_execution_time_enabled resolves auto via the clock cost; env::is_total_execution_time_enabled keeps the footer visible unless explicitly false - runner::needs_test_duration gates the clock reads behind the single set of duration consumers - reports::is_enabled extracted so the predicate can reuse it See adrs/adr-008-auto-skip-per-test-timing.md
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.
🤔 Background
Related #765
On shells without a native sub-second clock (Bash 3.2 on macOS),
bashunit::clock::nowfalls back to forking aperlinterpreter, so every test pays twoperlforks just to measure a duration that a plain run then discards.💡 Changes
BASHUNIT_SHOW_EXECUTION_TIMEtoauto: per-test times show when the clock is fork-free and hide when measuring would fork an interpreter.--profile,--verbose, a report, or an explicit execution-time display).auto; onlyfalsehides it.