mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-04 11:54:56 -04:00
Speed up @cachedList
(#13591)
This speeds things up by ~2x. The vast majority of the time is now spent in `LruCache` moving things around the linked lists. We do this via two things: 1. Don't create a deferred per-key during bulk set operations in `DeferredCache`. Instead, only create them if a subsequent caller asks for the key. 2. Add a bulk lookup API to `DeferredCache` rather than use a loop.
This commit is contained in:
parent
05c9c7363b
commit
f7ddfe17a3
4 changed files with 298 additions and 141 deletions
|
@ -135,6 +135,9 @@ class TreeCache:
|
|||
def values(self):
|
||||
return iterate_tree_cache_entry(self.root)
|
||||
|
||||
def items(self):
|
||||
return iterate_tree_cache_items((), self.root)
|
||||
|
||||
def __len__(self) -> int:
|
||||
return self.size
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue