Fewer round trips: light previews, cached names, cards a few at a time #261

Merged
littlefox merged 3 commits from issue-234-round-trips into main 2026-10-22 02:34:26 +00:00
Owner

Closes #234

  • Kom::preview no longer looks up who wrote each linked text (one get-text-stat each): only the full post shows those authors. A post with 500 replies cost 500 calls to preview.
  • Thread cards: six previews at a time in parallel, nearest the post being read first, each batch into the cards at once (was one after the other: 100 cards, 100 round trips). The inbox's 30 previews the same way.
  • Who is on: names from Kom's cache, missing ones 16 at a time (Kom::who_is_on), not one call per session all at once.
  • Unread checks look at a channel's read ranges in place (is_read_in) instead of copying them per text; the cursor no longer copies the whole seen set per batch.
  • Marks were batched in #254 (#228).

Measured with tools/perf.sh against main:

main after
inbox open 2 447 ms 1 936 ms (−21 %)
reading 120 cards by scrolling: layouts 35 18
reading 120 cards by scrolling: main-thread busy 0.37 s 0.27 s

(The perf data's posts have few replies; the light preview matters most on posts with many.)

Verified: devserver tests (15, incl. #251's), full e2e on three profiles 332 passed, lint four ways.

🤖 Generated with Claude Code

https://claude.ai/code/session_01XJW2ocwLunyaLiUwCBHEP8

Closes #234 - `Kom::preview` no longer looks up who wrote each linked text (one `get-text-stat` each): only the full post shows those authors. A post with 500 replies cost 500 calls to preview. - Thread cards: six previews at a time in parallel, nearest the post being read first, each batch into the cards at once (was one after the other: 100 cards, 100 round trips). The inbox's 30 previews the same way. - Who is on: names from `Kom`'s cache, missing ones 16 at a time (`Kom::who_is_on`), not one call per session all at once. - Unread checks look at a channel's read ranges in place (`is_read_in`) instead of copying them per text; the cursor no longer copies the whole `seen` set per batch. - Marks were batched in #254 (#228). Measured with `tools/perf.sh` against main: | | main | after | |---|---|---| | inbox open | 2 447 ms | 1 936 ms (−21 %) | | reading 120 cards by scrolling: layouts | 35 | 18 | | reading 120 cards by scrolling: main-thread busy | 0.37 s | 0.27 s | (The perf data's posts have few replies; the light preview matters most on posts with many.) Verified: devserver tests (15, incl. #251's), full e2e on three profiles 332 passed, lint four ways. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01XJW2ocwLunyaLiUwCBHEP8
- A preview (cards, lists, notifications) looked up who wrote every linked
  text, one text stat each, though nothing shows those authors outside
  the full post: a post with 500 replies cost 500 calls to preview.
  Kom::preview now skips them; view/read keep them.
- Who is on: names from Kom's cache, the missing ones a batch of 16 at a
  time, instead of one get-uconf-stat per session all at once.
- Unread checks look at a channel's read ranges in place instead of
  copying them for every text, and the reading cursor no longer copies
  the whole seen set for every batch.

Refs #234

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XJW2ocwLunyaLiUwCBHEP8
Resolves the conflicts with #254 (mark_read_many now checks read state in
place; the who-is-on list keeps presence::CHANGES and uses Kom::who_is_on).

Also, in this commit: the thread loader fetched each card's preview after
the one before, so 100 cards were 100 round trips before the last one
showed. Now six at a time in parallel (lyskomd penalises big bursts), the
cards nearest the post being read first, each batch into the cards at
once. The inbox's 30 newest previews the same way.

Refs #234

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XJW2ocwLunyaLiUwCBHEP8
Merge remote-tracking branch 'origin/main' into issue-234-round-trips
All checks were successful
ci / check (push) Successful in 12m26s
ci / desktop (push) Successful in 16m49s
ci / e2e (push) Successful in 32m55s
b94eecc794
littlefox referenced this pull request from a commit 2026-10-22 14:11:06 +00:00
Sign in to join this conversation.
No description provided.