mirror of
https://github.com/matrix-org/matrix-rust-sdk.git
synced 2026-04-21 07:37:47 -04:00
benchmarks: Use realistic Matrix IDs in linked_chunk
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 <zecakeh@tedomum.fr>
This commit is contained in:
committed by
Ivan Enderlin
parent
f0ae0e53f9
commit
39aa777b9b
@@ -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 =
|
||||
|
||||
Reference in New Issue
Block a user