Skip to content

Commit 5ad477a

Browse files
committed
tests: Rename some more benchmarks
1 parent 9754325 commit 5ad477a

File tree

5 files changed

+19
-18
lines changed

5 files changed

+19
-18
lines changed

benchmarks/benches/event_cache.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ fn handle_room_updates(c: &mut Criterion) {
2424
.build()
2525
.expect("Failed to create an asynchronous runtime");
2626

27-
let mut group = c.benchmark_group("reading");
27+
let mut group = c.benchmark_group("Event cache room updates");
2828
group.sample_size(10);
2929

3030
const NUM_EVENTS: usize = 1000;
@@ -50,9 +50,9 @@ fn handle_room_updates(c: &mut Criterion) {
5050
// Declare new stores for this set of events.
5151
let sqlite_temp_dir = tempdir().unwrap();
5252
let stores = vec![
53-
("memory store", MemoryStore::default().into_event_cache_store()),
53+
("memory", MemoryStore::default().into_event_cache_store()),
5454
(
55-
"sqlite store",
55+
"SQLite",
5656
runtime.block_on(async {
5757
SqliteEventCacheStore::open(sqlite_temp_dir.path().join("bench"), None)
5858
.await
@@ -70,7 +70,10 @@ fn handle_room_updates(c: &mut Criterion) {
7070

7171
// Bench the handling of room updates.
7272
group.bench_function(
73-
BenchmarkId::new(format!("handle_room_updates/{store_name}"), num_rooms),
73+
BenchmarkId::new(
74+
format!("Event cache room updates[{store_name}]"),
75+
format!("room count: {num_rooms}"),
76+
),
7477
|bencher| {
7578
// Ideally we'd use `iter_with_setup` here, but it doesn't allow an async setup
7679
// (which we need to setup the client), see also

benchmarks/benches/linked_chunk.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ fn writing(c: &mut Criterion) {
3737
let linked_chunk_id = LinkedChunkId::Room(room_id);
3838
let event_factory = EventFactory::new().room(room_id).sender(&ALICE);
3939

40-
let mut group = c.benchmark_group("writing");
40+
let mut group = c.benchmark_group("Linked chunk writing");
4141
group.sample_size(10).measurement_time(Duration::from_secs(30));
4242

4343
for &number_of_events in NUMBER_OF_EVENTS {
@@ -101,7 +101,7 @@ fn writing(c: &mut Criterion) {
101101

102102
// Get a bencher.
103103
group.bench_with_input(
104-
BenchmarkId::new(store_name, number_of_events),
104+
BenchmarkId::new(format!("Linked chunk writing [{store_name}]"), number_of_events),
105105
&operations,
106106
|bencher, operations| {
107107
// Bench the routine.
@@ -154,7 +154,7 @@ fn reading(c: &mut Criterion) {
154154
let linked_chunk_id = LinkedChunkId::Room(room_id);
155155
let event_factory = EventFactory::new().room(room_id).sender(&ALICE);
156156

157-
let mut group = c.benchmark_group("reading");
157+
let mut group = c.benchmark_group("Linked chunk reading");
158158
group.sample_size(10);
159159

160160
for &num_events in NUMBER_OF_EVENTS {
@@ -215,7 +215,7 @@ fn reading(c: &mut Criterion) {
215215

216216
// Bench the lazy loader.
217217
group.bench_function(
218-
BenchmarkId::new(format!("lazy_loader/{store_name}"), num_events),
218+
BenchmarkId::new(format!("Linked chunk lazy loader[{store_name}]"), num_events),
219219
|bencher| {
220220
// Bench the routine.
221221
bencher.to_async(&runtime).iter(|| async {
@@ -243,7 +243,7 @@ fn reading(c: &mut Criterion) {
243243

244244
// Bench the metadata loader.
245245
group.bench_function(
246-
BenchmarkId::new(format!("metadata/{store_name}"), num_events),
246+
BenchmarkId::new(format!("Linked chunk metadata loader[{store_name}]"), num_events),
247247
|bencher| {
248248
// Bench the routine.
249249
bencher.to_async(&runtime).iter(|| async {

benchmarks/benches/room_bench.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ pub fn receive_all_members_benchmark(c: &mut Criterion) {
8585
group.throughput(Throughput::Elements(count as u64));
8686
group.sample_size(50);
8787

88-
group.bench_function(BenchmarkId::new("receive_members", name), |b| {
88+
group.bench_function(BenchmarkId::new("Handle /members request [SQLite]", name), |b| {
8989
b.to_async(&runtime).iter(|| async {
9090
base_client.receive_all_members(&room_id, &request, &response).await.unwrap();
9191
});
@@ -165,11 +165,11 @@ pub fn load_pinned_events_benchmark(c: &mut Criterion) {
165165

166166
let count = PINNED_EVENTS_COUNT;
167167
let name = format!("{count} pinned events");
168-
let mut group = c.benchmark_group("Test");
168+
let mut group = c.benchmark_group("Load pinned events");
169169
group.throughput(Throughput::Elements(count as u64));
170170
group.sample_size(10);
171171

172-
group.bench_function(BenchmarkId::new("load_pinned_events", name), |b| {
172+
group.bench_function(BenchmarkId::new("Load pinned events [memory]", name), |b| {
173173
b.to_async(&runtime).iter(|| async {
174174
let pinned_event_ids = room.pinned_event_ids().unwrap_or_default();
175175
assert!(!pinned_event_ids.is_empty());

benchmarks/benches/store_bench.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,11 @@ pub fn restore_session(c: &mut Criterion) {
4545
let mut group = c.benchmark_group("Client reload");
4646
group.throughput(Throughput::Elements(100));
4747

48-
const NAME: &str = "restore a session";
49-
5048
// Memory
5149
let mem_store = Arc::new(MemoryStore::new());
5250
runtime.block_on(mem_store.save_changes(&changes)).expect("initial filling of mem failed");
5351

54-
group.bench_with_input(BenchmarkId::new("memory store", NAME), &mem_store, |b, store| {
52+
group.bench_with_input("Restore session [memory store]", &mem_store, |b, store| {
5553
b.to_async(&runtime).iter(|| async {
5654
let client = Client::builder()
5755
.homeserver_url("https://matrix.example.com")
@@ -79,7 +77,7 @@ pub fn restore_session(c: &mut Criterion) {
7977
.expect("initial filling of sqlite failed");
8078

8179
group.bench_with_input(
82-
BenchmarkId::new(format!("sqlite store {encrypted_suffix}"), NAME),
80+
BenchmarkId::new("Restore session [SQLite]", encrypted_suffix),
8381
&sqlite_store,
8482
|b, store| {
8583
b.to_async(&runtime).iter(|| async {

benchmarks/benches/timeline.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,12 +94,12 @@ pub fn create_timeline_with_initial_events(c: &mut Criterion) {
9494
room
9595
});
9696

97-
let mut group = c.benchmark_group("Test");
97+
let mut group = c.benchmark_group("Create a timeline");
9898
group.throughput(Throughput::Elements(NUM_EVENTS as _));
9999
group.sample_size(10);
100100

101101
group.bench_function(
102-
BenchmarkId::new("create_timeline_with_initial_events", format!("{NUM_EVENTS} events")),
102+
BenchmarkId::new("Create a timeline with initial events", format!("{NUM_EVENTS} events")),
103103
|b| {
104104
b.to_async(&runtime).iter(|| async {
105105
let timeline = TimelineBuilder::new(&room)

0 commit comments

Comments
 (0)