⚡ Bolt: [performance improvement] Cache FFmpeg/FFprobe binary resolution across loadlast module#171
Conversation
…ion across loadlast module - **What:** Replaced `shutil.which` calls and hardcoded strings with the cached `get_ffmpeg_bin` and `get_ffprobe_bin` from `core.bin_paths`. Changed `lru_cache` to `cache` in `core.bin_paths` and added a `cache_clear()` autouse fixture to `conftest.py`. - **Why:** To eliminate repeated file system I/O latency when resolving CLI tools during frequent FFMPEG processes. - **Impact:** Decreases latency and improves CPU time in hot paths parsing metadata. Measurements indicate a small but persistent performance win on repetitive video tasks. - **Verification:** Ran pytest tests successfully and observed no regressions. Documented learning in `.jules/bolt.md`. Co-authored-by: AEmotionStudio <163354043+AEmotionStudio@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
This PR addresses a performance issue where multiple locations across
loadlastand its processing modules (audio_extract.py,video_decode.py,video_edit.py,load_last_video.py) were either callingshutil.which("ffprobe")redundantly or passing hardcoded"ffmpeg"strings directly to subprocesses, triggering the OSPATHresolution on each run.Changes:
core/bin_paths.pyto use@functools.cacheinstead oflru_cache.conftest.pyto clean caches between tests.shutil.whichand"ffmpeg"/"ffprobe"strings inside subprocess lists within theloadlastmodule to call the newly imported caching functions fromcore.bin_paths..jules/bolt.md.PR created automatically by Jules for task 5413026181513106751 started by @AEmotionStudio