1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// // Authors: Robert Lopez
// use crate::{
// data_file::{data_block::DataBlock, DataFile},
// tests::{test_db::TestDB, util::random_bytes},
// };
// use tokio::time::Instant;
// #[tokio::test]
// async fn benchmark_writes() {
// let chunk_size = 4_096;
// let max_file_size = 4_096_000_000_000;
// let test_db = TestDB::open("benchmark_writes", Some(chunk_size), Some(max_file_size))
// .await
// .unwrap();
// let mut writes = vec![];
// let mut total_bytes = 0;
// for _ in 0..100 {
// let bytes = chunk_size * 100;
// total_bytes += bytes;
// writes.push(random_bytes(bytes));
// }
// let start = Instant::now();
// for write in writes {
// test_db.block_db.write(write).await.unwrap();
// }
// let end = Instant::now();
// println!(
// "benchmark_writes -- Bytes: {total_bytes} in {}ms",
// end.duration_since(start).as_millis()
// );
// test_db.cleanup().await.unwrap();
// }