summary refs log tree commit diff
path: root/synapse/util/caches
diff options
context:
space:
mode:
authorVincent Breitmoser <look@my.amazin.horse>2018-01-06 18:11:02 +0100
committerVincent Breitmoser <look@my.amazin.horse>2018-04-10 11:29:51 +0200
commit9fbe70a7dc3afabfdac176ba1f4be32dd44602aa (patch)
tree72df152671e195a687fecdd72b398658df9c14b7 /synapse/util/caches
parentMerge pull request #2996 from krombel/allow_auto_join_rooms (diff)
downloadsynapse-9fbe70a7dc3afabfdac176ba1f4be32dd44602aa.tar.xz
Use sortedcontainers instead of blist
This commit drop-in replaces blist with SortedContainers. They are
written in pure python so work with pypy, but perform as good as
native implementations, at least in a couple benchmarks:

http://www.grantjenks.com/docs/sortedcontainers/performance.html
Diffstat (limited to 'synapse/util/caches')
-rw-r--r--synapse/util/caches/stream_change_cache.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/synapse/util/caches/stream_change_cache.py b/synapse/util/caches/stream_change_cache.py
index 941d873ab8..2ff46090a6 100644
--- a/synapse/util/caches/stream_change_cache.py
+++ b/synapse/util/caches/stream_change_cache.py
@@ -16,7 +16,7 @@
 from synapse.util.caches import register_cache, CACHE_SIZE_FACTOR
 
 
-from blist import sorteddict
+from sortedcontainers import SortedDict
 import logging
 
 
@@ -35,7 +35,7 @@ class StreamChangeCache(object):
     def __init__(self, name, current_stream_pos, max_size=10000, prefilled_cache={}):
         self._max_size = int(max_size * CACHE_SIZE_FACTOR)
         self._entity_to_key = {}
-        self._cache = sorteddict()
+        self._cache = SortedDict()
         self._earliest_known_stream_pos = current_stream_pos
         self.name = name
         self.metrics = register_cache(self.name, self._cache)