_a2a_cs_x100.nx source
↩ module page · 19 lines · 467 B
1// CountSketch x100 for amortized timing
2import "syscalls.nx"
3import "sketch_count_sketch.nx"
4
5func main() -> i64 {
6 var iter: i64 = 0
7 while iter < 100 {
8 let cs: *CountSketch = nx_cs_alloc(5, 512, 42)
9 if cs == (0 as *CountSketch) { return 1 }
10 var i: i64 = 0
11 while i < 100000 {
12 let k: i64 = (i * 17) % 10000
13 nx_cs_add(cs, k, 1)
14 i = i + 1
15 }
16 iter = iter + 1
17 }
18 return 0
19}