mirror of
https://github.com/element-hq/synapse.git
synced 2026-11-04 13:28:04 +00:00
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