speed up execution from 11 to 5 seconds

This commit is contained in:
jacekpoz 2023-12-08 13:24:10 +01:00
parent 94d022bd01
commit e49e9b5ff7
No known key found for this signature in database
GPG key ID: 94E812A8B12AAE3C

View file

@ -163,7 +163,7 @@ fn main() -> anyhow::Result<()> {
let cpu = cpu.clone(); let cpu = cpu.clone();
let results = Arc::clone(&results); let results = Arc::clone(&results);
let handle = thread::spawn(move || { let handle = thread::spawn(move || {
for n in ((1000 + cpu * 1000)..=100000).step_by(1000 + cpu * 1000) { for n in ((1000 + cpu * 1000)..=100000).step_by(1000 * num_cpus) {
if results.read().expect("can't read results map").get(&(n as u64)).is_some() { if results.read().expect("can't read results map").get(&(n as u64)).is_some() {
continue; continue;
} }