@@ -440,6 +440,9 @@ def determine_best_candidate(
440440 # check if this code has been evaluated before by checking the ast normalized code string
441441 normalized_code = ast .unparse (ast .parse (candidate .source_code .flat .strip ()))
442442 if normalized_code in ast_code_to_id :
443+ logger .warning (
444+ "Current candidate has been encountered before in testing, Skipping optimization candidate."
445+ )
443446 past_opt_id = ast_code_to_id [normalized_code ]["optimization_id" ]
444447 # update speedup ratio, is_correct, optimizations_post, optimized_line_profiler_results, optimized_runtimes
445448 speedup_ratios [candidate .optimization_id ] = speedup_ratios [past_opt_id ]
@@ -588,8 +591,10 @@ def determine_best_candidate(
588591 if len (possible_refinement ) > 0 : # if the api returns a valid response
589592 refinement_response .append (possible_refinement [0 ])
590593 candidates .extend (refinement_response )
591- logger .info (f"Added { len (refinement_response )} candidates from refinement" )
592594 original_len += len (refinement_response )
595+ logger .info (
596+ f"Added { len (refinement_response )} candidates from refinement, total candidates now: { original_len } "
597+ )
593598 refinement_done = True
594599 except KeyboardInterrupt as e :
595600 self .write_code_and_helpers (
@@ -1099,11 +1104,6 @@ def find_and_process_best_optimization(
10991104 if best_optimization :
11001105 logger .info ("Best candidate:" )
11011106 code_print (best_optimization .candidate .source_code .flat )
1102- console .print (
1103- Panel (
1104- best_optimization .candidate .explanation , title = "Best Candidate Explanation" , border_style = "blue"
1105- )
1106- )
11071107 processed_benchmark_info = None
11081108 if self .args .benchmark :
11091109 processed_benchmark_info = process_benchmark_data (
@@ -1227,7 +1227,11 @@ def process_review(
12271227 file_path = explanation .file_path ,
12281228 benchmark_details = explanation .benchmark_details ,
12291229 )
1230+
12301231 best_optimization .candidate .set_explanation (new_explanation )
1232+
1233+ console .print (Panel (new_explanation_raw_str , title = "Best Candidate Explanation" , border_style = "blue" ))
1234+
12311235 data = {
12321236 "original_code" : original_code_combined ,
12331237 "new_code" : new_code_combined ,
0 commit comments