Files
amethyst/commons/plans
Claude b79217b09c perf(commons): halve the list observables' write cost, and measure it
The copy-on-write rewrite of the two list observables was justified on
portability -- `java.util.concurrent` has no KMP equivalent, which is what
kept them in `jvmAndroid` behind an iOS stub. That says nothing about
speed, and these are hot: every consumed event is offered to each observer
whose filter could match it, from each relay's socket coroutine.

So measure it. `ObserverListBenchmark` keeps the `ConcurrentSkipListSet`
implementation verbatim as the baseline and as a differential oracle --
`bothImplementationsAgree` asserts the two emit identical lists for
identical input at limits null/50/400, which is the property the rewrite
had to preserve. Runs in ~7s, asserts on correctness only, never on wall
time.

The first run said the rewrite was a regression: slower on the limited
insert path and 4.9x slower on 8 threads, with no thread scaling. The
cause was one line, not the design. `State.plus` published `ids + added`,
and over the limit `ids + added - dropped`; each operator allocates a full
copy of the set, so the eviction path rebuilt membership twice per insert.
One `HashSet`, sized up front and mutated before publishing, is the fix.

After it, against the implementation it replaced: re-delivering an already
listed note 3.3-4.1x faster, insert into a populated unlimited list (what
nearly every observer registers) 1.3-1.5x faster and widening with n, cold
fill at n=5000 1.8x faster, concurrent inserts at parity on one thread and
2.1-2.7x slower on 4-8.

That last number is a real cost and is written on both classes rather than
left out: threads serialize on one reference and a lost CAS discards its
copy, where the skip list striped across keys and scaled. Two things bound
it -- the benchmark's threads do nothing but insert, while real ingest
spends most of its per-event budget verifying signatures and parsing
before it reaches an observer; and nearly every production observer
registers with no limit, which is the shape copy-on-write wins.

Also recorded, since it framed the earlier discussion wrong: lock-free was
never the difference between the two. The skip-list version was lock-free
too -- ConcurrentHashMap stripes per key, so `compute` holds a bin, not a
monitor. The choice was portability and speed.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KkULS5SVq4GHDdoCzajKi8
2026-09-21 18:42:13 +00:00
..

commons plans

Audited 2026-06-30 (+ 2026-09-12 split entry). 7 plans: 3 shipped, 2 in-progress, 2 queued, 0 abandoned.

In progress

Plan Summary
2026-05-04-custom-feeds-plan.md Custom feed creation/discovery/management for Desktop; core model + builder + kind 31890 + desktop UI shipped, but relay-filter layer, DVM marketplace, kind 10090 sync, and list resolution still pending.
2026-05-06-nest-subscription-manager-extraction.md Split the per-speaker subscription state machine out of NestViewModel; only the ActiveSubscription stepping-stone is extracted so far.

Queued

Plan Summary
2026-04-21-event-renderer.md Cross-platform UI-agnostic RenderedEvent subsystem shared by Amy, Desktop, and Android; not started.
2026-05-30-amethyst-to-commons-migration.md Roadmap to move shared amethyst Android code into commons; keystone Account/LocalCache extraction not begun.
2026-08-03-poll-results-page.md Extended NIP-88 poll results page (per-option counts + who voted for what) for Android and Desktop; also specifies four tally-correctness fixes and the missing poll-relay subscription. Proposed, not started.

Shipped

Plan Summary
2026-09-12-audit-findings.md Bug/performance audit of commons + commonsUI after the split: 34 verified fixes shipped, 4 deferred with rationale, 6 rejected.
2026-09-12-commons-ui-split.md Split the Compose half of commons into the new :commonsUI module (same packages, api(:commons)), so cli no longer carries Compose/Skiko; records the classification method and follow-ups.

Archived (shipped)

Plan Summary
archive/2026-05-04-custom-feeds-testing-sheet.md Test sheet recording the completed custom-feeds phases (unit + manual coverage).
archive/2026-05-05-feed-builder-enhancements-plan.md Six FeedBuilderDialog enhancements (npub decode, author search, kind filters, edit/delete, save-as-feed, exclude authors) — all landed.