ptrcports/alpine/wireguard-vanity-address/infinite.patch

31 lines
998 B
Diff
Raw Normal View History

--- a/src/bin.rs
+++ b/src/bin.rs
@@ -121,13 +121,15 @@
// get_physical() appears to be more accurate: hyperthreading doesn't
// help us much
+ let cpus = num_cpus::get_physical();
+ rayon::ThreadPoolBuilder::new().num_threads(cpus).build_global().unwrap();
if trials_per_key < 2u64.pow(32) {
let raw_rate = measure_rate();
println!(
"one core runs at {}, CPU cores available: {}",
format_rate(raw_rate),
- num_cpus::get_physical(),
+ cpus,
);
let total_rate = raw_rate * (num_cpus::get_physical() as f64) / (trials_per_key as f64);
let seconds_per_key = 1.0 / total_rate;
@@ -140,9 +142,7 @@
println!("hit Ctrl-C to stop");
- // 1M trials takes about 10s on my laptop, so let it run for 1000s
- (0..100_000_000)
- .into_par_iter()
+ rayon::iter::repeat(0)
.map(|_| search_for_prefix(&prefix, 0, end))
.try_for_each(print)?;
Ok(())