Idle cost: timers and global signals that redraw while nothing happens #233
Labels
No labels
area/ci
area/desktop
area/packaging
area/protocol
area/reading
area/ui
area/web
area/writing
kind/bug
kind/feature
kind/infra
kind/request
needs/user
parked
perf
security
upstream
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
littlefox/neokom#233
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Found in the codebase review (#230, D-058). With NeoKOM open and untouched, it should cost close to nothing. Battery matters on laptops and phones. Today:
SEEN_JS(app/src/main_view/mod.rs, #180) runs every 250 ms for as long as the reader is visible, even when nothing moves. Each run doesquerySelectorAllandgetBoundingClientRecton every unread card, which forces layout. Use anIntersectionObserver, plus a timer only while a card is waiting out its second (see #228).CLOCK(app/src/when.rs) ticks every 30 s.ThreadPaneandChannelPostsPaneread it at the top, so every 30 s the whole thread or channel (up to hundreds of cards) re-renders to update "5 min sedan".Whenlabels read it.app/src/presence.rs) replaces the wholeHEREmap every 120 s. EveryDotreadsHERE, so every dot on screen re-renders even when nobody changed. Write only the entries that changed, or give each person their own signal.Measure: CPU time of the tab (Chrome performance monitor) and of the desktop process over 10 idle minutes with a long thread open, before and after.
Merged in #271 (main #452 green). Presence dots are now redrawn only when the state or title they show changes (
use_memo), so an idle page doesn't redraw every dot on each presence tick. Together with the earlier #226/#228 changes (no CLOCK in the panes, event-driven seen-marking) an idle page is quiet. Verified: full e2e suite on the branch, clippy three ways.