File tree Expand file tree Collapse file tree 3 files changed +22
-4
lines changed Expand file tree Collapse file tree 3 files changed +22
-4
lines changed Original file line number Diff line number Diff line change @@ -131,7 +131,9 @@ def leave_SimpleStatementLine(
131
131
if matching_original_times and matching_optimized_times :
132
132
original_time = min (matching_original_times )
133
133
optimized_time = min (matching_optimized_times )
134
- perf_gain = performance_gain (original_runtime_ns = original_time , optimized_runtime_ns = optimized_time )
134
+ perf_gain = (
135
+ performance_gain (original_runtime_ns = original_time , optimized_runtime_ns = optimized_time ) * 100
136
+ )
135
137
# Create the runtime comment
136
138
comment_text = f"# { format_time (original_time )} -> { format_time (optimized_time )} ({ perf_gain :.2f} %)"
137
139
Original file line number Diff line number Diff line change @@ -99,9 +99,12 @@ def existing_tests_source_for(
99
99
optimized_tests_to_runtimes [filename ][qualified_name ]
100
100
> original_tests_to_runtimes [filename ][qualified_name ]
101
101
)
102
- perf_gain = performance_gain (
103
- original_runtime_ns = original_tests_to_runtimes [filename ][qualified_name ],
104
- optimized_runtime_ns = optimized_tests_to_runtimes [filename ][qualified_name ],
102
+ perf_gain = (
103
+ performance_gain (
104
+ original_runtime_ns = original_tests_to_runtimes [filename ][qualified_name ],
105
+ optimized_runtime_ns = optimized_tests_to_runtimes [filename ][qualified_name ],
106
+ )
107
+ * 100
105
108
)
106
109
if greater :
107
110
output += f" - { qualified_name } : { print_original_runtime } { arrow } { print_optimized_runtime } $$\\ color{{red}}({ perf_gain :.2f} \\ \\ %)$$\n "
Original file line number Diff line number Diff line change 12
12
TestType ,
13
13
VerificationType ,
14
14
)
15
+ from codeflash .verification .verification_utils import TestConfig
15
16
16
17
17
18
class TestAddRuntimeComments :
@@ -48,6 +49,18 @@ def test_basic_runtime_comment_addition(self):
48
49
assert codeflash_output == [1, 2, 3]
49
50
"""
50
51
52
+ """test_cfg: TestConfig,
53
+ generated_tests: GeneratedTestsList,
54
+ original_runtimes: dict[InvocationId, list[int]],
55
+ optimized_runtimes: dict[InvocationId, list[int]]"""
56
+ project_root_path = file_path .parent .resolve ()
57
+ test_config = TestConfig (
58
+ tests_root = "tests" ,
59
+ tests_project_rootdir = Path .cwd (),
60
+ project_root_path = project_root_path ,
61
+ test_framework = "pytest" ,
62
+ pytest_cmd = "pytest" ,
63
+ )
51
64
generated_test = GeneratedTests (
52
65
generated_original_test_source = test_source ,
53
66
instrumented_behavior_test_source = "" ,
You can’t perform that action at this time.
0 commit comments