Skip to content

Commit 2025fb4

Browse files
committed
rustfmt macros
1 parent 594a2a7 commit 2025fb4

File tree

1 file changed

+74
-24
lines changed

1 file changed

+74
-24
lines changed

benches/bench.rs

Lines changed: 74 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ extern crate test;
88

99
use test::{black_box, Bencher};
1010

11-
use hashbrown::HashMap;
1211
use hashbrown::hash_map::DefaultHashBuilder;
12+
use hashbrown::HashMap;
1313
use std::collections::hash_map::RandomState;
1414

1515
const SIZE: usize = 1000;
@@ -28,15 +28,15 @@ struct RandomKeys {
2828

2929
impl RandomKeys {
3030
fn new(size: usize) -> Self {
31-
RandomKeys{
31+
RandomKeys {
3232
remaining: size,
3333
state: 1,
3434
}
3535
}
3636

3737
// Produce a different set of random values.
3838
fn new2(size: usize) -> Self {
39-
RandomKeys{
39+
RandomKeys {
4040
remaining: size,
4141
state: 2,
4242
}
@@ -70,13 +70,21 @@ macro_rules! bench_insert {
7070
black_box(m);
7171
})
7272
}
73-
}
73+
};
7474
}
7575

7676
bench_insert!(insert_fx_serial, FxHashMap, 0..SIZE);
7777
bench_insert!(insert_std_serial, StdHashMap, 0..SIZE);
78-
bench_insert!(insert_fx_highbits, FxHashMap, (0..SIZE).map(usize::swap_bytes));
79-
bench_insert!(insert_std_highbits, StdHashMap, (0..SIZE).map(usize::swap_bytes));
78+
bench_insert!(
79+
insert_fx_highbits,
80+
FxHashMap,
81+
(0..SIZE).map(usize::swap_bytes)
82+
);
83+
bench_insert!(
84+
insert_std_highbits,
85+
StdHashMap,
86+
(0..SIZE).map(usize::swap_bytes)
87+
);
8088
bench_insert!(insert_fx_random, FxHashMap, RandomKeys::new(SIZE));
8189
bench_insert!(insert_std_random, StdHashMap, RandomKeys::new(SIZE));
8290

@@ -96,13 +104,21 @@ macro_rules! bench_insert_erase {
96104
black_box(m);
97105
})
98106
}
99-
}
107+
};
100108
}
101109

102110
bench_insert_erase!(insert_erase_fx_serial, FxHashMap, 0..SIZE);
103111
bench_insert_erase!(insert_erase_std_serial, StdHashMap, 0..SIZE);
104-
bench_insert_erase!(insert_erase_fx_highbits, FxHashMap, (0..SIZE).map(usize::swap_bytes));
105-
bench_insert_erase!(insert_erase_std_highbits, StdHashMap, (0..SIZE).map(usize::swap_bytes));
112+
bench_insert_erase!(
113+
insert_erase_fx_highbits,
114+
FxHashMap,
115+
(0..SIZE).map(usize::swap_bytes)
116+
);
117+
bench_insert_erase!(
118+
insert_erase_std_highbits,
119+
StdHashMap,
120+
(0..SIZE).map(usize::swap_bytes)
121+
);
106122
bench_insert_erase!(insert_erase_fx_random, FxHashMap, RandomKeys::new(SIZE));
107123
bench_insert_erase!(insert_erase_std_random, StdHashMap, RandomKeys::new(SIZE));
108124

@@ -121,13 +137,21 @@ macro_rules! bench_lookup {
121137
}
122138
})
123139
}
124-
}
140+
};
125141
}
126142

127143
bench_lookup!(lookup_fx_serial, FxHashMap, 0..SIZE);
128144
bench_lookup!(lookup_std_serial, StdHashMap, 0..SIZE);
129-
bench_lookup!(lookup_fx_highbits, FxHashMap, (0..SIZE).map(usize::swap_bytes));
130-
bench_lookup!(lookup_std_highbits, StdHashMap, (0..SIZE).map(usize::swap_bytes));
145+
bench_lookup!(
146+
lookup_fx_highbits,
147+
FxHashMap,
148+
(0..SIZE).map(usize::swap_bytes)
149+
);
150+
bench_lookup!(
151+
lookup_std_highbits,
152+
StdHashMap,
153+
(0..SIZE).map(usize::swap_bytes)
154+
);
131155
bench_lookup!(lookup_fx_random, FxHashMap, RandomKeys::new(SIZE));
132156
bench_lookup!(lookup_std_random, StdHashMap, RandomKeys::new(SIZE));
133157

@@ -146,17 +170,35 @@ macro_rules! bench_lookup_fail {
146170
}
147171
})
148172
}
149-
}
173+
};
150174
}
151175

152-
bench_lookup_fail!(lookup_fail_fx_serial, FxHashMap, 0..SIZE, SIZE..SIZE*2);
153-
bench_lookup_fail!(lookup_fail_std_serial, StdHashMap, 0..SIZE, SIZE..SIZE*2);
154-
bench_lookup_fail!(lookup_fail_fx_highbits, FxHashMap, (0..SIZE).map(usize::swap_bytes),
155-
(SIZE..SIZE*2).map(usize::swap_bytes));
156-
bench_lookup_fail!(lookup_fail_std_highbits, StdHashMap, (0..SIZE).map(usize::swap_bytes),
157-
(SIZE..SIZE*2).map(usize::swap_bytes));
158-
bench_lookup_fail!(lookup_fail_fx_random, FxHashMap, RandomKeys::new(SIZE), RandomKeys::new2(SIZE));
159-
bench_lookup_fail!(lookup_fail_std_random, StdHashMap, RandomKeys::new(SIZE), RandomKeys::new2(SIZE));
176+
bench_lookup_fail!(lookup_fail_fx_serial, FxHashMap, 0..SIZE, SIZE..SIZE * 2);
177+
bench_lookup_fail!(lookup_fail_std_serial, StdHashMap, 0..SIZE, SIZE..SIZE * 2);
178+
bench_lookup_fail!(
179+
lookup_fail_fx_highbits,
180+
FxHashMap,
181+
(0..SIZE).map(usize::swap_bytes),
182+
(SIZE..SIZE * 2).map(usize::swap_bytes)
183+
);
184+
bench_lookup_fail!(
185+
lookup_fail_std_highbits,
186+
StdHashMap,
187+
(0..SIZE).map(usize::swap_bytes),
188+
(SIZE..SIZE * 2).map(usize::swap_bytes)
189+
);
190+
bench_lookup_fail!(
191+
lookup_fail_fx_random,
192+
FxHashMap,
193+
RandomKeys::new(SIZE),
194+
RandomKeys::new2(SIZE)
195+
);
196+
bench_lookup_fail!(
197+
lookup_fail_std_random,
198+
StdHashMap,
199+
RandomKeys::new(SIZE),
200+
RandomKeys::new2(SIZE)
201+
);
160202

161203
macro_rules! bench_iter {
162204
($name:ident, $maptype:ident, $keydist:expr) => {
@@ -173,12 +215,20 @@ macro_rules! bench_iter {
173215
}
174216
})
175217
}
176-
}
218+
};
177219
}
178220

179221
bench_iter!(iter_fx_serial, FxHashMap, 0..SIZE);
180222
bench_iter!(iter_std_serial, StdHashMap, 0..SIZE);
181-
bench_iter!(iter_fx_highbits, FxHashMap, (0..SIZE).map(usize::swap_bytes));
182-
bench_iter!(iter_std_highbits, StdHashMap, (0..SIZE).map(usize::swap_bytes));
223+
bench_iter!(
224+
iter_fx_highbits,
225+
FxHashMap,
226+
(0..SIZE).map(usize::swap_bytes)
227+
);
228+
bench_iter!(
229+
iter_std_highbits,
230+
StdHashMap,
231+
(0..SIZE).map(usize::swap_bytes)
232+
);
183233
bench_iter!(iter_fx_random, FxHashMap, RandomKeys::new(SIZE));
184234
bench_iter!(iter_std_random, StdHashMap, RandomKeys::new(SIZE));

0 commit comments

Comments
 (0)