perf(desktop): paginate usage activity - #4539
Conversation
15e250d to
0bb0081
Compare
|
CC @liuxiaocs7 |
|
Thanks for working on this. The core pagination behavior appears to address #4531, and CI is green. I found the following issues before merge: Standards
Spec / verification
|
0bb0081 to
22d229c
Compare
Large usage histories rebuilt every activity row on each tab visit. Limiting each page to 50 records keeps repeated navigation responsive. CLOSES apache#4531 Generated-by: OpenAI Codex Signed-off-by: Jiawei Zhao <Phoenix500526@163.com>
22d229c to
201f380
Compare
Done |
|
@liuxiaocs7 The latest CI run failed on the unrelated |
|
Thank you for the analysis. However, I don’t have permission to rerun the CI checks. Could you please push an empty commit to trigger CI again? |
Summary
The slowdown came from Settings → Usage → Activity log rendering every
matching record whenever the tab was opened. With hundreds of records, React
rebuilt the entire table—including per-row tooltips and actions—on every visit.
Paginate the log at 50 records per page so only the visible rows are mounted.
Searching, changing status, or clearing filters returns the table to the first
page.
Fixes #4531
Verification
npm --workspace @maka/desktop run typechecknpm exec -- biome linton the changed TypeScript filesnpm run format:check(1,857 files)npm run check:renderer-architecture -- --base upstream/main(61 tests)npm --workspace @maka/desktop run build-storybooknpm --workspace @maka/desktop run smoke:storybook(502 renders)on the same build: all rows median 1,616.9 ms / p95 1,670.2 ms; 50 per page
median 74.0 ms / p95 80.0 ms; 21.9× faster by median
The benchmark measures Activity log rendering only; it does not include
loading the usage history from the backend.
UI
Before Change
After Change
Benchmark result
Save this snippet as
/tmp/maka-usage-benchmark.cjs, then run it from a Makacheckout with dependencies and Playwright Chromium installed.
$ cd maka-agent $ node /tmp/maka-usage-benchmark.cjs All rows: median 1616.9 ms, p95 1670.2 ms 50/page: median 74.0 ms, p95 80.0 ms Speedup: 21.9x by medianAI use
Select exactly one:
Tool(s) and scope: OpenAI Codex assisted with implementation, tests,
benchmarking, review, and verification.
Checklist
Does this PR entail a change in behavior?