Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions benchmarks/random-access-bench/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,21 +149,25 @@ async fn benchmark_random_access(
let time_limit = Duration::from_secs(time_limit_secs);
let overall_start = Instant::now();
let mut runs = Vec::new();
let mut accessor = open_accessor(dataset, format).await?;
let cached_accessor = if reopen {
None
} else {
Some(open_accessor(dataset, format).await?)
};

loop {
let start = Instant::now();
let arr = accessor.take(indices).await?;
let arr = if let Some(accessor) = &cached_accessor {
accessor.take(indices).await?
} else {
open_accessor(dataset, format).await?.take(indices).await?
};
runs.push(start.elapsed());
drop(arr);

if overall_start.elapsed() >= time_limit {
break;
}

if reopen {
accessor = open_accessor(dataset, format).await?;
}
}

let timing = TimingMeasurement {
Expand Down
Loading