You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
perf: Add FilenameCache to cache compute_filename results (#2904)
Changed below autoresearch implementation to just have one universal
FilenameCache
---
Add class-level caches to StacktraceInterface for two expensive per-frame
operations that repeat with identical inputs:
longest_load_path: Previously iterated $LOAD_PATH for every frame,
creating many intermediate strings. Now cached by abs_path with automatic
invalidation when $LOAD_PATH.size changes (e.g. after Bundler.require).
compute_filename: Many frames share identical abs_paths (same gem files
appear in every exception). Results are cached in separate in_app/
not_in_app hashes keyed by abs_path only, avoiding composite array keys.
Cache invalidates on project_root or $LOAD_PATH changes.
Both caches are deterministic — same inputs always produce the same
filename. The caches grow proportionally to the number of unique source
files seen, which is naturally bounded in any application.
0 commit comments