summary refs log tree commit diff
diff options
context:
space:
mode:
authorEric Eastwood <erice@element.io>2022-08-19 02:35:29 -0500
committerEric Eastwood <erice@element.io>2022-08-19 02:35:29 -0500
commit0dbc7501abc0ab56db12dd1fcc25724190362e2a (patch)
treed4e1468bbc6cdb9ba639025b449ec86bd619777f
parentBetter benchmark (diff)
downloadsynapse-github/madlittlemods/optimize-have_seen_events.tar.xz
-rw-r--r--tests/storage/databases/main/test_events_worker.py22
1 files changed, 11 insertions, 11 deletions
diff --git a/tests/storage/databases/main/test_events_worker.py b/tests/storage/databases/main/test_events_worker.py
index 8a64af082a..2b12038dd6 100644
--- a/tests/storage/databases/main/test_events_worker.py
+++ b/tests/storage/databases/main/test_events_worker.py
@@ -94,7 +94,7 @@ class HaveSeenEventsTestCase(unittest.HomeserverTestCase):
             )
             self.event_ids.append(event_id)
 
-    # TODO: Remove me before mergin
+    # TODO: Remove me before merging
     def test_benchmark(self):
         import time
 
@@ -132,15 +132,15 @@ class HaveSeenEventsTestCase(unittest.HomeserverTestCase):
 
         with LoggingContext(name="test") as ctx:
 
-            def time_have_seen_events(test_index: int, event_ids):
+            def time_have_seen_events(test_prefix: str, event_ids):
                 benchmark_start_time = time.time()
                 remaining_event_ids = self.get_success(
                     self.store.have_seen_events(room_id, event_ids)
                 )
                 benchmark_end_time = time.time()
                 logger.info(
-                    "Benchmark time%s: %s",
-                    test_index,
+                    "Benchmark time (%s): %s",
+                    "{test_prefix: <13}".format(test_prefix=test_prefix),
                     (benchmark_end_time - benchmark_start_time),
                 )
                 self.assertIsNotNone(remaining_event_ids)
@@ -148,13 +148,13 @@ class HaveSeenEventsTestCase(unittest.HomeserverTestCase):
             event_ids_odd = event_ids[::2]
             event_ids_even = event_ids[1::2]
 
-            time_have_seen_events(1, event_ids)
-            time_have_seen_events(2, event_ids)
-            time_have_seen_events(3, event_ids)
-            time_have_seen_events(4, event_ids_odd)
-            time_have_seen_events(5, event_ids_odd)
-            time_have_seen_events(6, event_ids_even)
-            time_have_seen_events(7, event_ids_even)
+            time_have_seen_events("1 cold cache", event_ids)
+            time_have_seen_events("2, warm cache", event_ids)
+            time_have_seen_events("3, warm cache", event_ids)
+            time_have_seen_events("4, odds", event_ids_odd)
+            time_have_seen_events("5, odds", event_ids_odd)
+            time_have_seen_events("6, evens", event_ids_even)
+            time_have_seen_events("7, evens", event_ids_even)
 
             # that should result in a many db queries
             self.assertEqual(ctx.get_resource_usage().db_txn_count, 1)