Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
Already on GitHub? Sign in to your account
Speed up get_current_state_ids #2108
Conversation
erikjohnston
assigned
richvdh
Apr 7, 2017
| @@ -69,17 +69,24 @@ def __init__(self, hs): | ||
| where_clause="type='m.room.member'", | ||
| ) | ||
| - @cachedInlineCallbacks(max_entries=100000, iterable=True) | ||
| + @cached(max_entries=100000, iterable=True) | ||
| def get_current_state_ids(self, room_id): |
richvdh
assigned
erikjohnston
and unassigned
richvdh
Apr 7, 2017
erikjohnston
merged commit 0cd01f5
into
develop
Apr 7, 2017
7 of 8 checks passed
Sytest Dendron (Commit)
Build #1923 origin/erikj/current_state_ids failed in 9 min 4 sec
Details
Sytest Dendron (Merged PR)
Build finished.
Details
Sytest Postgres (Commit)
Build #2752 origin/erikj/current_state_ids succeeded in 7 min 37 sec
Details
Sytest Postgres (Merged PR)
Build finished.
Details
Sytest SQLite (Commit)
Build #2822 origin/erikj/current_state_ids succeeded in 6 min 46 sec
Details
Sytest SQLite (Merged PR)
Build finished.
Details
continuous-integration/travis-ci/pr
The Travis CI build passed
Details
continuous-integration/travis-ci/push
The Travis CI build passed
Details
psaavedra
added a commit
to psaavedra/synapse
that referenced
this pull request
May 19, 2017
erikjohnston
deleted the
erikj/current_state_ids
branch
Oct 26, 2017
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
erikjohnston commentedApr 7, 2017
Using
_simple_select_listis fairly expensive for functions that return a lot of rows and/or get called a lot.(This is because it carefully constructs a list of dicts).
get_current_state_idsgets called a lot on startup and e.g. when the IRC bridge decided to send tonnes of joins/leaves (as it invalidates the cache). We therefore replace it with a custom txn function that buildsup the final result dict without building up and intermediate representation.