mirror of
https://github.com/qdrant/qdrant.git
synced 2026-08-06 01:50:57 -05:00
* build(deps): bump rand_distr from 0.5.1 to 0.6.0 Bumps [rand_distr](https://github.com/rust-random/rand_distr) from 0.5.1 to 0.6.0. - [Release notes](https://github.com/rust-random/rand_distr/releases) - [Changelog](https://github.com/rust-random/rand_distr/blob/master/CHANGELOG.md) - [Commits](https://github.com/rust-random/rand_distr/compare/0.5.1...0.6.0) --- updated-dependencies: - dependency-name: rand_distr dependency-version: 0.6.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * Migrate main code base to rand 0.10 * Migrate tests * Migrate benches --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: timvisee <tim@visee.me>
36 lines
1013 B
Rust
36 lines
1013 B
Rust
use std::time::Instant;
|
|
|
|
use common::types::PointOffsetType;
|
|
use criterion::{Criterion, criterion_group, criterion_main};
|
|
use rand::RngExt;
|
|
use segment::id_tracker::IdTracker;
|
|
use segment::id_tracker::in_memory_id_tracker::InMemoryIdTracker;
|
|
use segment::types::ExtendedPointId;
|
|
|
|
fn benchmark(c: &mut Criterion) {
|
|
c.bench_function("idtracker", |b| {
|
|
b.iter_custom(|i| {
|
|
let mut id_tracker = InMemoryIdTracker::new();
|
|
let mut rand = rand::rng();
|
|
|
|
let ids: Vec<i32> = (0..i).map(|_| rand.random_range(0..100_000)).collect();
|
|
|
|
let start = Instant::now();
|
|
|
|
for external in 0..i {
|
|
id_tracker
|
|
.set_link(
|
|
ExtendedPointId::NumId(external),
|
|
ids[external as usize] as PointOffsetType,
|
|
)
|
|
.unwrap();
|
|
}
|
|
|
|
start.elapsed()
|
|
})
|
|
});
|
|
}
|
|
|
|
criterion_group!(benches, benchmark);
|
|
criterion_main!(benches);
|