diff options
author | Richard van der Hoff <richard@matrix.org> | 2018-07-12 11:37:44 +0100 |
---|---|---|
committer | Richard van der Hoff <richard@matrix.org> | 2018-07-12 11:37:44 +0100 |
commit | fa5c2bc082185580e7d65a8759a8b5213933a137 (patch) | |
tree | d17427df60d28be7fabed6f6ecf0de5dc2a05c5f /synapse/util/caches | |
parent | Merge pull request #3505 from matrix-org/erikj/receipts_cahce (diff) | |
download | synapse-fa5c2bc082185580e7d65a8759a8b5213933a137.tar.xz |
Reduce set building in get_entities_changed
This line shows up as about 5% of cpu time on a synchrotron: not_known_entities = set(entities) - set(self._entity_to_key) Presumably the problem here is that _entity_to_key can be largeish, and building a set for its keys every time this function is called is slow. Here we rewrite the logic to avoid building so many sets.
Diffstat (limited to 'synapse/util/caches')
-rw-r--r-- | synapse/util/caches/stream_change_cache.py | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/synapse/util/caches/stream_change_cache.py b/synapse/util/caches/stream_change_cache.py |