Commit 7bf9e14
committed
perf(ccusage): reuse usage JSONL scanner for blocks
Blocks no longer need non-usage JSONL timestamps for file ordering, but the block Bun byte path still iterated every line and manually checked whether the current line contained the usage marker.
Reuse the shared usage-line scanner instead. This keeps blocks on the same marker-driven path as daily/session, removes the redundant per-line marker guard, and shrinks the ccusage build from 405.25 kB to 404.44 kB.
Same-host A/B, Apple M3 Pro, real local Claude data, LOG_LEVEL=0, COLUMNS=200, built Bun dist, hyperfine via comma:
- blocks --offline --json: 419.2ms +/- 20.1ms -> 412.0ms +/- 5.8ms (~1.02x)
- blocks --offline table: 420.7ms +/- 21.2ms -> 416.9ms +/- 9.4ms (~1.01x)
Latest JS/Rust #977 reference after this change:
- JS daily/session/blocks JSON: 352.9ms / 368.8ms / 411.4ms
- Rust daily/session/blocks JSON: 245.9ms / 253.1ms / 256.1ms
Validation: pnpm run format; pnpm typecheck; pnpm run test; pnpm --filter ccusage run build; baseline/current JSON parity for daily/session/blocks/monthly/weekly; baseline/current table parity for daily/session/blocks; Bun/Node JSON parity for daily/session/blocks/monthly/weekly.1 parent f58638b commit 7bf9e14
1 file changed
Lines changed: 1 addition & 26 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2007 | 2007 | | |
2008 | 2008 | | |
2009 | 2009 | | |
2010 | | - | |
2011 | | - | |
2012 | | - | |
2013 | | - | |
2014 | 2010 | | |
2015 | 2011 | | |
2016 | 2012 | | |
| |||
2074 | 2070 | | |
2075 | 2071 | | |
2076 | 2072 | | |
2077 | | - | |
2078 | | - | |
2079 | | - | |
2080 | | - | |
2081 | | - | |
2082 | | - | |
2083 | | - | |
2084 | | - | |
2085 | | - | |
2086 | | - | |
2087 | | - | |
2088 | | - | |
2089 | | - | |
2090 | | - | |
2091 | | - | |
2092 | | - | |
2093 | | - | |
2094 | | - | |
2095 | | - | |
2096 | | - | |
2097 | | - | |
2098 | | - | |
| 2073 | + | |
2099 | 2074 | | |
2100 | 2075 | | |
2101 | 2076 | | |
| |||
0 commit comments