diff --git a/src/main.rs b/src/main.rs index 0684013..43a9af3 100644 --- a/src/main.rs +++ b/src/main.rs @@ -139,16 +139,20 @@ impl SField { loop_count += 1; const MILLIS_PER_SEC: u128 = 1_000; const UPDATE_DELAY_MS: u128 = 80; - if now.elapsed().as_millis() >= UPDATE_DELAY_MS { + if loop_count % 1000 == 0 { + let elapsed_ms = now.elapsed().as_millis(); + if elapsed_ms <= UPDATE_DELAY_MS { + continue; + } self.print_clear(); self.print(); println!( "{} loops/sec", - (loop_count - last_loop_count) * (MILLIS_PER_SEC / UPDATE_DELAY_MS) + (loop_count - last_loop_count) * (MILLIS_PER_SEC / elapsed_ms) ); println!( "{} solutions/sec", - (num_solutions - last_num_solutions) * (MILLIS_PER_SEC / UPDATE_DELAY_MS) + (num_solutions - last_num_solutions) * (MILLIS_PER_SEC / elapsed_ms) ); last_loop_count = loop_count; last_num_solutions = num_solutions;