Files
synapse/rust
Erik JohnstonandClaude Opus 5.5 c3ee410acc Cut sliding sync's per-room Python calls from Rust
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
2026-10-16 18:22:31 +00:00
..