Skip to content

Commit a30a3d6

Browse files
committed
Increase performance noise floor for really minute runtimes, catch a bug in replay test creation
1 parent 1d2bbf7 commit a30a3d6

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

codeflash/discovery/functions_to_optimize.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -389,13 +389,12 @@ def visit_ClassDef(self, node: ast.ClassDef) -> None:
389389

390390
def inspect_top_level_functions_or_methods(
391391
file_name: Path, function_or_method_name: str, class_name: str | None = None, line_no: int | None = None
392-
) -> FunctionProperties:
392+
) -> FunctionProperties | None:
393393
with open(file_name, encoding="utf8") as file:
394394
try:
395395
ast_module = ast.parse(file.read())
396-
except Exception as e:
397-
logger.exception(e)
398-
return False
396+
except Exception:
397+
return None
399398
visitor = TopLevelFunctionOrMethodVisitor(
400399
file_name=file_name, function_or_method_name=function_or_method_name, class_name=class_name, line_no=line_no
401400
)

codeflash/result/critic.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def speedup_critic(
3232
The noise floor is doubled when benchmarking on a (noisy) GitHub Action virtual instance, also we want to be more confident there.
3333
"""
3434
in_github_actions_mode = bool(env_utils.get_pr_number())
35-
noise_floor = 2 * MIN_IMPROVEMENT_THRESHOLD if original_code_runtime < 10000 else MIN_IMPROVEMENT_THRESHOLD
35+
noise_floor = 3 * MIN_IMPROVEMENT_THRESHOLD if original_code_runtime < 10000 else MIN_IMPROVEMENT_THRESHOLD
3636
if in_github_actions_mode:
3737
noise_floor = noise_floor * 2 # Increase the noise floor in GitHub Actions mode
3838

codeflash/tracing/replay_test.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def create_trace_replay_test(
5050
"""
5151

5252
# TODO: Module can have "-" character if the module-root is ".". Need to handle that case
53-
function_properties: list[FunctionProperties] = [
53+
function_properties: list[FunctionProperties | None] = [
5454
inspect_top_level_functions_or_methods(
5555
file_name=function.file_name,
5656
function_or_method_name=function.function_name,
@@ -61,6 +61,8 @@ def create_trace_replay_test(
6161
]
6262
function_imports = []
6363
for function, function_property in zip(functions, function_properties):
64+
if function_property is None:
65+
continue
6466
if not function_property.is_top_level:
6567
# can't be imported and run in the replay test
6668
continue

0 commit comments

Comments
 (0)