add stub for database benches
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
parent
d0132706cd
commit
b03c493bf9
2 changed files with 19 additions and 0 deletions
17
src/database/benches.rs
Normal file
17
src/database/benches.rs
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
#[cfg(conduwuit_bench)]
|
||||||
|
extern crate test;
|
||||||
|
|
||||||
|
#[cfg(conduwuit_bench)]
|
||||||
|
#[cfg_attr(conduwuit_bench, bench)]
|
||||||
|
fn ser_str(b: &mut test::Bencher) {
|
||||||
|
use conduwuit::ruma::{RoomId, UserId};
|
||||||
|
|
||||||
|
use crate::ser::serialize_to_vec;
|
||||||
|
|
||||||
|
let user_id: &UserId = "@user:example.com".try_into().unwrap();
|
||||||
|
let room_id: &RoomId = "!room:example.com".try_into().unwrap();
|
||||||
|
b.iter(|| {
|
||||||
|
let key = (user_id, room_id);
|
||||||
|
let _s = serialize_to_vec(key).expect("failed to serialize user_id");
|
||||||
|
});
|
||||||
|
}
|
|
@ -5,6 +5,8 @@ conduwuit::mod_ctor! {}
|
||||||
conduwuit::mod_dtor! {}
|
conduwuit::mod_dtor! {}
|
||||||
conduwuit::rustc_flags_capture! {}
|
conduwuit::rustc_flags_capture! {}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod benches;
|
||||||
mod cork;
|
mod cork;
|
||||||
mod de;
|
mod de;
|
||||||
mod deserialized;
|
mod deserialized;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue