@@ -635,6 +635,7 @@ def determine_best_candidate(
635635 replay_performance_gain = replay_perf_gain if self .args .benchmark else None ,
636636 winning_benchmarking_test_results = candidate_result .benchmarking_test_results ,
637637 winning_replay_benchmarking_test_results = candidate_result .benchmarking_test_results ,
638+ async_throughput = candidate_result .async_throughput ,
638639 )
639640 valid_optimizations .append (best_optimization )
640641 # queue corresponding refined optimization for best optimization
@@ -697,6 +698,7 @@ def determine_best_candidate(
697698 replay_performance_gain = valid_opt .replay_performance_gain ,
698699 winning_benchmarking_test_results = valid_opt .winning_benchmarking_test_results ,
699700 winning_replay_benchmarking_test_results = valid_opt .winning_replay_benchmarking_test_results ,
701+ async_throughput = valid_opt .async_throughput ,
700702 )
701703 valid_candidates_with_shorter_code .append (new_best_opt )
702704 diff_lens_list .append (
@@ -1281,6 +1283,23 @@ def process_review(
12811283 original_runtimes_all = original_runtime_by_test ,
12821284 optimized_runtimes_all = optimized_runtime_by_test ,
12831285 )
1286+ original_throughput_str = None
1287+ optimized_throughput_str = None
1288+ throughput_improvement_str = None
1289+
1290+ if (
1291+ self .function_to_optimize .is_async
1292+ and original_code_baseline .async_throughput is not None
1293+ and best_optimization .async_throughput is not None
1294+ ):
1295+ original_throughput_str = f"{ original_code_baseline .async_throughput } operations/second"
1296+ optimized_throughput_str = f"{ best_optimization .async_throughput } operations/second"
1297+ throughput_improvement_value = throughput_gain (
1298+ original_throughput = original_code_baseline .async_throughput ,
1299+ optimized_throughput = best_optimization .async_throughput ,
1300+ )
1301+ throughput_improvement_str = f"{ throughput_improvement_value * 100 :.1f} %"
1302+
12841303 new_explanation_raw_str = self .aiservice_client .get_new_explanation (
12851304 source_code = code_context .read_writable_code .flat ,
12861305 dependency_code = code_context .read_only_context_code ,
@@ -1294,6 +1313,9 @@ def process_review(
12941313 annotated_tests = generated_tests_str ,
12951314 optimization_id = best_optimization .candidate .optimization_id ,
12961315 original_explanation = best_optimization .candidate .explanation ,
1316+ original_throughput = original_throughput_str ,
1317+ optimized_throughput = optimized_throughput_str ,
1318+ throughput_improvement = throughput_improvement_str ,
12971319 )
12981320 new_explanation = Explanation (
12991321 raw_explanation_message = new_explanation_raw_str or explanation .raw_explanation_message ,
0 commit comments