From 39aa777b9bf968f9834a546512f7bdfdabf103fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Commaille?= Date: Wed, 4 Mar 2026 09:18:15 +0100 Subject: [PATCH] benchmarks: Use realistic Matrix IDs in linked_chunk MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We rely on the EventFactory to generate a hash of the events for the event IDs, and we use the appropriate length for room IDs. Signed-off-by: Kévin Commaille --- benchmarks/benches/linked_chunk.rs | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/benchmarks/benches/linked_chunk.rs b/benchmarks/benches/linked_chunk.rs index 29dd354f7..7d206ad46 100644 --- a/benchmarks/benches/linked_chunk.rs +++ b/benchmarks/benches/linked_chunk.rs @@ -10,7 +10,7 @@ use matrix_sdk_base::event_cache::{ store::{DEFAULT_CHUNK_CAPACITY, DynEventCacheStore, IntoEventCacheStore, MemoryStore}, }; use matrix_sdk_test::{ALICE, event_factory::EventFactory}; -use ruma::{EventId, room_id}; +use ruma::room_id; use tempfile::tempdir; use tokio::runtime::Builder; @@ -33,7 +33,7 @@ fn writing(c: &mut Criterion) { .build() .expect("Failed to create an asynchronous runtime"); - let room_id = room_id!("!foo:bar.baz"); + let room_id = room_id!("!fabricandofitfaber:bar.baz"); let linked_chunk_id = LinkedChunkId::Room(room_id); let event_factory = EventFactory::new().room(room_id).sender(&ALICE); @@ -66,12 +66,7 @@ fn writing(c: &mut Criterion) { { let mut events = (0..number_of_events) - .map(|nth| { - event_factory - .text_msg("foo") - .event_id(&EventId::parse(format!("$ev{nth}")).unwrap()) - .into_event() - }) + .map(|nth| event_factory.text_msg(format!("foo {nth}")).into_event()) .peekable(); let mut gap_nth = 0; @@ -149,7 +144,7 @@ fn reading(c: &mut Criterion) { .build() .expect("Failed to create an asynchronous runtime"); - let room_id = room_id!("!foo:bar.baz"); + let room_id = room_id!("!fabricandofitfaber:bar.baz"); let linked_chunk_id = LinkedChunkId::Room(room_id); let event_factory = EventFactory::new().room(room_id).sender(&ALICE); @@ -177,12 +172,7 @@ fn reading(c: &mut Criterion) { // Store some events and gap chunks in the store. { let mut events = (0..num_events) - .map(|nth| { - event_factory - .text_msg("foo") - .event_id(&EventId::parse(format!("$ev{nth}")).unwrap()) - .into_event() - }) + .map(|nth| event_factory.text_msg(format!("foo {nth}")).into_event()) .peekable(); let mut lc =