mirror of
https://github.com/element-hq/synapse.git
synced 2026-11-04 15:37:49 +00:00
The benchmark showed two per-room costs under the GIL on large accounts: - Sorting called the events stream cache's `get_max_pos_of_last_change` once per joined room, 2000 Python calls per request on a 2000-room account, even for a [0,19] list. That method is a lookup in the cache's `_entity_to_key` dict, so Rust now reads the dict directly. - `RoomStatusMapView` imported `HaveSentRoom` and built a new object for each room the extensions asked about, about 13 us a call. The class is frozen, so one `LIVE` and one `NEVER` value now serve every room. Rust's reactor time on an incremental request on a 2000-room account fell from 0.55 of Python's to 0.35, and with a [0,499] list and extensions from 0.84 to 0.49. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L51DoxB8VnH8UjXJFDgpNG