# Key Performance Insights ## 🔴 Slowest Functions - **generate_direct_comic**: 118.74s total (2 calls, avg 59.37s) - **generate_comic**: 76.33s total (2 calls, avg 38.16s) - **generate_image_fn**: 76.20s total (2 calls, avg 38.10s) - **generate_image_narration**: 36.40s total (2 calls, avg 18.20s) ## 🟡 Medium Duration Functions - **enhance_user_story**: 10.01s total (6 calls, avg 1.67s) - **extract_comic_scenes**: 2.71s total (2 calls, avg 1.35s) ## 🟢 Fast Functions - All other functions executed in **milliseconds (< 0.01s each)** --- # Notable Observations - **Huge Performance Difference**: The second run of `generate_image_fn` took **73.82s** vs only **2.38s** in the first run – likely due to the API error in the first attempt vs successful generation in the second. - **Error Impact**: The first `generate_direct_comic` run (**22.15s**) was much faster than the second (**96.58s**) because the first failed at image generation due to the OpenAI verification error. - **Most Function Calls**: `enhance_user_story` and `_create_detail_focused_enhancement_prompt` were called **6 times each**, indicating retry logic during the enhancement process. - **Total Runtime**: The entire process took approximately **5.35 minutes (320.39s)** across **48 function calls**. --- ⚠️ **Main Bottleneck**: The **image generation and processing pipeline** accounts for **over 90%** of the total execution time.