Skip to content

Commit 2f2c7a3

Browse files
committed
cleanup code a bit
1 parent b02de16 commit 2f2c7a3

1 file changed

Lines changed: 11 additions & 11 deletions

File tree

crates/hash-sorted-map/benchmarks/performance.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -444,12 +444,12 @@ fn bench_merge_sort(c: &mut Criterion) {
444444
.collect();
445445

446446
// Pre-build sorted containers from the input data.
447-
let sorted_containers: Vec<_> = maps_data
448-
.iter()
447+
let hash_maps: Vec<_> = maps_data
448+
.into_iter()
449449
.map(|keys| {
450-
let mut map: HashSortedMap<u32, u32, _> =
450+
let mut map =
451451
HashSortedMap::with_hasher(IdentityBuildHasher::default());
452-
for &key in keys {
452+
for key in keys {
453453
*map.entry(key).or_default() += 1u32;
454454
}
455455
map
@@ -465,7 +465,7 @@ fn bench_merge_sort(c: &mut Criterion) {
465465
b.iter(|| {
466466
let mut map: HashSortedMap<u32, u32, _> =
467467
HashSortedMap::with_hasher(IdentityBuildHasher::default());
468-
for container in &sorted_containers {
468+
for container in &hash_maps {
469469
for (&key, &value) in container {
470470
*map.entry(key).or_default() += value;
471471
}
@@ -480,7 +480,7 @@ fn bench_merge_sort(c: &mut Criterion) {
480480

481481
b.iter(|| {
482482
// Phase 1: build per-container sorted (hash, key, count) vectors.
483-
let sorted_vecs: Vec<Vec<(u64, u32, u32)>> = sorted_containers
483+
let sorted_vecs: Vec<Vec<(u64, u32, u32)>> = hash_maps
484484
.iter()
485485
.map(|container| {
486486
let mut vec: Vec<(u64, u32, u32)> = container
@@ -510,7 +510,7 @@ fn bench_merge_sort(c: &mut Criterion) {
510510
b.iter(|| {
511511
let mut map =
512512
hashbrown::HashMap::<u32, u32, IdentityBuildHasher>::with_hasher(IdentityBuildHasher::default());
513-
for container in &sorted_containers {
513+
for container in &hash_maps {
514514
for (&key, &value) in container {
515515
*map.entry(key).or_default() += value;
516516
}
@@ -526,7 +526,7 @@ fn bench_merge_sort(c: &mut Criterion) {
526526
b.iter(|| {
527527
let mut map =
528528
hashbrown::HashMap::<u32, u32, IdentityBuildHasher>::with_hasher(IdentityBuildHasher::default());
529-
for container in &sorted_containers {
529+
for container in &hash_maps {
530530
for (&key, &value) in container {
531531
*map.entry(key).or_default() += value;
532532
}
@@ -540,7 +540,7 @@ fn bench_merge_sort(c: &mut Criterion) {
540540
b.iter(|| {
541541
let mut map: HashSortedMap<u32, u32, _> =
542542
HashSortedMap::with_hasher(IdentityBuildHasher::default());
543-
for container in &sorted_containers {
543+
for container in &hash_maps {
544544
for (&key, &value) in container {
545545
*map.entry(key).or_default() += value;
546546
}
@@ -557,7 +557,7 @@ fn bench_merge_sort(c: &mut Criterion) {
557557
1_000_000,
558558
IdentityBuildHasher::default(),
559559
);
560-
for container in &sorted_containers {
560+
for container in &hash_maps {
561561
for (&key, &value) in container {
562562
*map.entry(key).or_default() += value;
563563
}
@@ -574,7 +574,7 @@ fn bench_merge_sort(c: &mut Criterion) {
574574
1_000_000,
575575
IdentityBuildHasher::default(),
576576
);
577-
for container in &sorted_containers {
577+
for container in &hash_maps {
578578
for (&key, &value) in container {
579579
*map.entry(key).or_default() += value;
580580
}

0 commit comments

Comments
 (0)