diff options
| author | Craig Jennings <c@cjennings.net> | 2025-11-11 18:51:33 -0600 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2025-11-11 18:51:33 -0600 |
| commit | b0cfac99c5715740e152c9519fbe2912a91971a3 (patch) | |
| tree | 19afc954620da9c9eb71649551c175017f6a5af0 /.localrepo/el-mock-20220625.1949.tar | |
| parent | 8aa0eb544a8365ad99a9c11bd74969ebbbed1524 (diff) | |
perf: Cache org-agenda files to improve view performance
Applied same caching strategy as org-refile to org-agenda file building.
Root Cause:
- cj/build-org-agenda-list scanned projects-dir recursively
- Called on EVERY agenda view (F8, C-f8)
- directory-files-recursively scans 3,959 files to find 7 todo.org files
- Contributes to 30+ second agenda view time
Solution Implemented:
1. Cache layer with 1-hour TTL
- First view: builds and caches file list (one-time cost)
- Subsequent views: use cache (instant)
- Auto-refresh after 1 hour or Emacs restart
2. Async cache building
- Runs 10 seconds after Emacs idle (non-blocking)
- Zero startup impact
- Cache ready before first agenda view in typical workflow
3. Manual refresh available
- M-x cj/org-agenda-refresh-files
- Use after adding new projects/todo.org files
- Force rebuild bypasses cache
4. Robust error handling
- Building flag prevents concurrent builds
- unwind-protect ensures flag always clears
- Graceful handling if user views agenda before async build completes
Changes (modules/org-agenda-config.el):
- Added cache variables (lines 85-97)
- Modified cj/build-org-agenda-list for caching (lines 116-161)
- Added cj/org-agenda-refresh-files for manual refresh (lines 171-177)
- Async build via run-with-idle-timer (lines 163-169)
- Enhanced commentary documenting performance (lines 6-12)
- Removed emacs-startup-hook (now using idle timer)
Expected Impact:
- Reduces one component of 30+ second agenda view delay
- File list building: several seconds → instant (cached)
- Combined with org-refile optimization: significant daily time savings
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Diffstat (limited to '.localrepo/el-mock-20220625.1949.tar')
0 files changed, 0 insertions, 0 deletions
