-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathupdate_time_gsum_test.go
More file actions
41 lines (36 loc) · 1.18 KB
/
update_time_gsum_test.go
File metadata and controls
41 lines (36 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package promsketch
import (
"fmt"
"strconv"
"testing"
"time"
)
// Test update time per item under different memory configuration and sliding window sizes
func TestUpdateTimGSum(t *testing.T) {
readCAIDA()
total_length := int64(7000000)
sliding_window_sizes := []int64{10000, 100000, 1000000, 7000000}
for _, query_window_size := range sliding_window_sizes {
if query_window_size > total_length {
break
}
fmt.Println("sliding window size:", query_window_size)
// PromSketch, SHUniv
beta_input := []float64{0.7071, 0.5, 0.3535, 0.25, 0.177, 0.125, 0.0884, 0.0625, 0.044}
for _, beta := range beta_input {
fmt.Println("SHUniv", beta)
shu := SmoothInitUnivMon(beta, query_window_size)
insert_compute := 0.0
for t := int64(0); t < total_length; t++ {
start := time.Now()
shu.Update(t, strconv.FormatFloat(cases[0].vec[t].F, 'f', -1, 64))
elapsed := time.Since(start)
insert_compute += float64(elapsed.Microseconds())
}
update_time := float64(insert_compute) / float64(total_length)
fmt.Println("insert compute:", insert_compute, "us")
fmt.Println("update time per item:", update_time, "us")
fmt.Println("memory:", shu.GetMemory(), "KB")
}
}
}