Skip to content

Commit c862b4d

Browse files
committed
add low prob of repeating optimization
1 parent eb3d305 commit c862b4d

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

codeflash/code_utils/config_consts.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@
99
TOTAL_LOOPING_TIME = 10.0 # 10 second candidate benchmarking budget
1010
COVERAGE_THRESHOLD = 60.0
1111
MIN_TESTCASE_PASSED_THRESHOLD = 6
12+
REPEAT_OPTIMIZATION_PROBABILITY = 0.1

codeflash/discovery/functions_to_optimize.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
from codeflash.discovery.discover_unit_tests import discover_unit_tests
2929
from codeflash.models.models import FunctionParent
3030
from codeflash.telemetry.posthog_cf import ph
31+
from codeflash.code_utils.config_consts import REPEAT_OPTIMIZATION_PROBABILITY
3132

3233
if TYPE_CHECKING:
3334
from libcst import CSTNode
@@ -506,6 +507,10 @@ def check_optimization_status(
506507
if path_key not in already_optimized_paths:
507508
filtered_functions[file_path].append(func)
508509
remaining_count += 1
510+
else:
511+
if random.random() < REPEAT_OPTIMIZATION_PROBABILITY:
512+
filtered_functions[file_path].append(func)
513+
remaining_count += 1
509514

510515
return dict(filtered_functions), remaining_count
511516

0 commit comments

Comments
 (0)