Files
synapse/tests
Erik JohnstonandClaude Opus 5.5 52e3b09859 Cut sliding sync's database queries in Rust
The phase 6 bench found Rust making 2 to 6 times Python's queries: 8 per
room computed, and 4 on an incremental request where nothing changed.

- Bundled aggregations read the thread summary, edits and references
  through Rust caches that mirror Python's `get_thread_summary`,
  `get_applicable_edit` and `get_references_for_event`, so Python's
  invalidations reach them. The thread summary takes one statement with a
  window count, where it took a transaction of up to two. v2 sync in Rust
  shares these reads.
- `ignored_users` reads through a mirror of Python's cache.
- The `instance_map` table is cached. It only gains rows, so a stored
  token naming a writer the cache lacks drops the cache and reads again.
- The self-leave query is skipped when the membership stream cache says
  the user's membership has not changed since the `to_token`, the
  shortcut Python's query carries as a TODO.
- On a room's first send, the name and the required state come from one
  state read. Rooms with heroes keep a second read for their memberships.

On the bench, initial sync goes from 173 queries to 49, the range
expansion from 662 to 178 (Python makes 335), and a no-op incremental
from 4 to 0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KETBASkkVomGNnbut9NWQq
2026-10-17 10:25:01 +00:00
..
2026-09-18 12:00:45 +01:00
2026-10-14 13:35:25 +00:00