@@ -26,7 +26,10 @@ def performance_gain(*, original_runtime_ns: int, optimized_runtime_ns: int) ->
2626
2727
2828def speedup_critic (
29- candidate_result : OptimizedCandidateResult , original_code_runtime : int , best_runtime_until_now : int
29+ candidate_result : OptimizedCandidateResult ,
30+ original_code_runtime : int ,
31+ best_runtime_until_now : int ,
32+ disable_gh_action_noise : bool | None = None ,
3033) -> bool :
3134 """Take in a correct optimized Test Result and decide if the optimization should actually be surfaced to the user.
3235
@@ -35,10 +38,11 @@ def speedup_critic(
3538 when the original runtime is less than 10 microseconds, and becomes MIN_IMPROVEMENT_THRESHOLD for any higher runtime.
3639 The noise floor is doubled when benchmarking on a (noisy) GitHub Action virtual instance, also we want to be more confident there.
3740 """
38- in_github_actions_mode = bool (env_utils .get_pr_number ())
3941 noise_floor = 3 * MIN_IMPROVEMENT_THRESHOLD if original_code_runtime < 10000 else MIN_IMPROVEMENT_THRESHOLD
40- if in_github_actions_mode :
41- noise_floor = noise_floor * 2 # Increase the noise floor in GitHub Actions mode
42+ if not disable_gh_action_noise :
43+ in_github_actions_mode = bool (env_utils .get_pr_number ())
44+ if in_github_actions_mode :
45+ noise_floor = noise_floor * 2 # Increase the noise floor in GitHub Actions mode
4246
4347 perf_gain = performance_gain (
4448 original_runtime_ns = original_code_runtime , optimized_runtime_ns = candidate_result .best_test_runtime
0 commit comments