Skip to content

Commit 1b02dc4

Browse files
majiayu000claude
andcommitted
perf(ccusage): add timestamp cache for faster file processing
Add a persistent timestamp cache to dramatically improve performance when loading usage data from JSONL files. Previously, every run needed to read all files to extract timestamps for sorting. Now timestamps are cached and only updated when files change. Key optimizations: - Cache file timestamps to ~/.config/claude/.ccusage/timestamp-cache.json - Use file mtime to detect when cache entries are stale - Early filter files by date range before sorting (using --since/--until) - Only read first 4KB of files to extract timestamps - Batch process files with controlled concurrency (50 at a time) Performance improvement on 8600+ files: - Full data query: 28.2s → 8.4s (3.4x faster) - With --since filter: 11.4s → 8.1s (1.4x faster) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 6335626 commit 1b02dc4

2 files changed

Lines changed: 481 additions & 8 deletions

File tree

0 commit comments

Comments
 (0)