Skip to content

Commit e226474

Browse files
committed
chore: improving estimates
1 parent 1b08694 commit e226474

File tree

2 files changed

+29
-2
lines changed

2 files changed

+29
-2
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,9 @@ The table below shows realistic scenarios:
150150
| Bits | 16 threads 🖥️<br>(**systematic search**) | 2048 threads 🏭<br>(**systematic search**) | 2048 threads 🏭<br>(**random search**) | | |
151151
|------|------------------------------------------|---------------------------------------------|----------------------------------------|-------------------|---------------------|
152152
| | Worst-case time | Worst-case time | Expected time | 99th percentile | 99.9th percentile |
153-
| 1‑6 | 31 s | 30 s | 30 s | 2 min 19 s | 3 min 27 s |
154-
| 7 | 2 min 4 s | 30 s | 30 s | 2 min 19 s | 3 min 27 s |
153+
| 1‑5 | 30 s | 30 s | 30 s | 2 min 19 s | 3 min 27 s |
154+
| 6 | 1 min 0 s | 30 s | 30 s | 2 min 19 s | 3 min 27 s |
155+
| 7 | 2 min 0 s | 30 s | 30 s | 2 min 19 s | 3 min 27 s |
155156
| 8 | 4 min 8 s | 30 s | 30 s | 2 min 19 s | 3 min 27 s |
156157
| 9 | 8 min 0 s | 30 s | 30 s | 2 min 19 s | 3 min 27 s |
157158
| 10 | 16 min 30 s | 30 s | 31 s | 2 min 23 s | 3 min 33 s |

wskdf-cli/src/main.rs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -872,4 +872,30 @@ mod tests {
872872
calculate_random_times(calculate_search_space(20), 2048, 30.0);
873873
assert_eq!(random_expected_20, 7680.0); // 2 hours 8 minutes in seconds
874874
}
875+
876+
#[test]
877+
fn test_6bit_calculation_fix() {
878+
// Test the specific 6-bit calculation issue identified in README.md
879+
// 6-bit systematic search (16 threads, 30s): ceil(32/16) * 30 = 2 * 30 = 60s = 1min 0s
880+
881+
let space_6bit = calculate_search_space(6); // 2^5 = 32
882+
assert_eq!(space_6bit, 32.0);
883+
884+
let (_, systematic_worst_6) = calculate_systematic_times(space_6bit, 16, 30.0);
885+
assert_eq!(systematic_worst_6, 60.0); // Should be 60 seconds, not 31
886+
assert_eq!(pretty(systematic_worst_6), "1min 0s"); // Should format as 1min 0s
887+
888+
// Also verify bits 1-5 are correct at 30s each
889+
for bits in 1..=5 {
890+
let space = calculate_search_space(bits);
891+
let (_, worst) = calculate_systematic_times(space, 16, 30.0);
892+
assert_eq!(worst, 30.0, "Bit {bits} should have 30s worst-case time");
893+
}
894+
895+
// And verify 7-bit is 2min 0s, not 2min 4s
896+
let space_7bit = calculate_search_space(7); // 2^6 = 64
897+
let (_, systematic_worst_7) = calculate_systematic_times(space_7bit, 16, 30.0);
898+
assert_eq!(systematic_worst_7, 120.0); // Should be 120 seconds
899+
assert_eq!(pretty(systematic_worst_7), "2min 0s"); // Should format as 2min 0s
900+
}
875901
}

0 commit comments

Comments
 (0)