11from __future__ import annotations
22
3- from typing import TYPE_CHECKING , Optional
3+ from typing import TYPE_CHECKING
44
55from codeflash .cli_cmds .console import logger
66from codeflash .code_utils import env_utils
@@ -29,7 +29,8 @@ def speedup_critic(
2929 candidate_result : OptimizedCandidateResult ,
3030 original_code_runtime : int ,
3131 best_runtime_until_now : int | None ,
32- disable_gh_action_noise : Optional [bool ] = None ,
32+ * ,
33+ disable_gh_action_noise : bool = False ,
3334) -> bool :
3435 """Take in a correct optimized Test Result and decide if the optimization should actually be surfaced to the user.
3536
@@ -39,10 +40,8 @@ def speedup_critic(
3940 The noise floor is doubled when benchmarking on a (noisy) GitHub Action virtual instance, also we want to be more confident there.
4041 """
4142 noise_floor = 3 * MIN_IMPROVEMENT_THRESHOLD if original_code_runtime < 10000 else MIN_IMPROVEMENT_THRESHOLD
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
43+ if not disable_gh_action_noise and env_utils .is_ci ():
44+ noise_floor = noise_floor * 2 # Increase the noise floor in GitHub Actions mode
4645
4746 perf_gain = performance_gain (
4847 original_runtime_ns = original_code_runtime , optimized_runtime_ns = candidate_result .best_test_runtime
0 commit comments