开始优化算法了(

This commit is contained in:
shenjack 2024-02-29 00:39:56 +08:00
parent eb892dccad
commit 92e37f4676
Signed by: shenjack
GPG Key ID: 7B1134A979775551

View File

@ -40,7 +40,7 @@ const allow_d: u32 = 10;
const report_interval: u32 = 1_000_0000; const report_interval: u32 = 1_000_0000;
fn cacl(max: u64, step: usize, top: u32, id: u64) { fn cacl(max: u64, step: usize, top: u32, id: u64) {
let start_time = std::time::Instant::now(); let mut start_time = std::time::Instant::now();
let mut k: u64 = 0; let mut k: u64 = 0;
let mut top = top; let mut top = top;
for i in (0+id..max).step_by(step) { for i in (0+id..max).step_by(step) {
@ -61,6 +61,7 @@ fn cacl(max: u64, step: usize, top: u32, id: u64) {
if k > report_interval as u64 { if k > report_interval as u64 {
let now = std::time::Instant::now(); let now = std::time::Instant::now();
info!("{} {} {}/s", k, id, k / now.duration_since(start_time).as_secs()); info!("{} {} {}/s", k, id, k / now.duration_since(start_time).as_secs());
start_time = now;
k = 0; k = 0;
} }
} }