|
90 | 90 | from codeflash.verification.equivalence import compare_test_results |
91 | 91 | from codeflash.verification.instrument_codeflash_capture import instrument_codeflash_capture |
92 | 92 | from codeflash.verification.parse_line_profile_test_output import parse_line_profile_results |
93 | | -from codeflash.verification.parse_test_output import calculate_function_throughput_from_stdout, parse_test_results |
| 93 | +from codeflash.verification.parse_test_output import calculate_function_throughput_from_test_results, parse_test_results |
94 | 94 | from codeflash.verification.test_runner import run_behavioral_tests, run_benchmarking_tests, run_line_profile_tests |
95 | 95 | from codeflash.verification.verification_utils import get_test_file_path |
96 | 96 | from codeflash.verification.verifier import generate_tests |
@@ -1528,14 +1528,9 @@ def establish_original_code_baseline( |
1528 | 1528 |
|
1529 | 1529 | async_throughput = None |
1530 | 1530 | if self.function_to_optimize.is_async: |
1531 | | - all_stdout = "" |
1532 | | - for result in benchmarking_results.test_results: |
1533 | | - if result.stdout: |
1534 | | - all_stdout += result.stdout |
1535 | 1531 | logger.info("Calculating async function throughput from test output...") |
1536 | | - logger.info(f"All stdout for async throughput calculation:\n{all_stdout}") |
1537 | | - async_throughput = calculate_function_throughput_from_stdout( |
1538 | | - all_stdout, self.function_to_optimize.function_name |
| 1532 | + async_throughput = calculate_function_throughput_from_test_results( |
| 1533 | + benchmarking_results, self.function_to_optimize.function_name |
1539 | 1534 | ) |
1540 | 1535 | logger.info(f"Original async function throughput: {async_throughput} calls/second") |
1541 | 1536 |
|
@@ -1700,13 +1695,8 @@ def run_optimized_candidate( |
1700 | 1695 |
|
1701 | 1696 | candidate_async_throughput = None |
1702 | 1697 | if self.function_to_optimize.is_async and candidate_benchmarking_results: |
1703 | | - all_stdout = "" |
1704 | | - for result in candidate_benchmarking_results.test_results: |
1705 | | - if result.stdout: |
1706 | | - all_stdout += result.stdout |
1707 | | - |
1708 | | - candidate_async_throughput = calculate_function_throughput_from_stdout( |
1709 | | - all_stdout, self.function_to_optimize.function_name |
| 1698 | + candidate_async_throughput = calculate_function_throughput_from_test_results( |
| 1699 | + candidate_benchmarking_results, self.function_to_optimize.function_name |
1710 | 1700 | ) |
1711 | 1701 |
|
1712 | 1702 | if self.args.benchmark: |
|
0 commit comments