usage

usage 0.28.16

工具與目錄
在這頁

效能 1 項

01

閒置時少做白工,Usage 更省 CPU 與硬碟

電腦明明沒在操作 Usage,CPU 與硬碟卻不該一直忙著翻舊帳。這版把背景整理改成像圖書館只查看剛歸還的書:它會依 FSEvents(macOS 告知哪些檔案改過的通知)只挑出有變動的檔案。於是它只讀取有變動的 Claude、Codex 工作階段 JSONL(每行存一筆資料的紀錄檔),不再每次更新都重翻成千上萬個檔案;仍會定期全面檢查,避免漏掉變更。啟動時,價格表與更新檢查也會尊重既有快取(把查過的結果暫存起來直接用)的有效期限,不再每次重抓。Codex 的限流資料會共用檔案索引,SQLite(放在單一檔案裡的小型資料庫)檔沒變就不讀;解析快取更分成 32 份,活躍工作階段只改自己的那份。結果是閒置時明顯減少 CPU 與硬碟讀寫,啟動也少做無謂工作。

官方原文

**Idle CPU and disk I/O cut significantly across the board.** History scanning now uses FSEvents-reported paths to stat only changed files instead of re-walking and stat'ing every Claude/Codex session JSONL (thousands of files) on every refresh tick; a full rescan still runs periodically as a safety net. Startup no longer unconditionally re-downloads the pricing table or checks for updates — both now respect their existing cache freshness windows. Codex rate-limit reads reuse the same file index instead of re-scanning session directories, and SQLite reads (thread metadata, rate limits) are skipped entirely when the underlying database file hasn't changed. The on-disk parse cache is now sharded into 32 buckets so a single active session only rewrites its own shard instead of the whole multi-megabyte cache file.