-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmain-bench.go
72 lines (61 loc) · 1.5 KB
/
main-bench.go
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
package main
import (
"fmt"
"time"
vc "github.com/hyperproofs/hyperproofs-go/vcs"
)
const FOLDER = "./pkvk-26"
func BenchmarkVCSCommit(L uint8, txnLimit uint64) string {
N := uint64(1) << L
K := txnLimit
vcs := vc.VCS{}
vcs.KeyGenLoad(16, L, FOLDER, K)
aFr := vc.GenerateVector(N)
dt := time.Now()
vcs.Commit(aFr, uint64(L))
duration := time.Since(dt)
out := fmt.Sprintf("BenchmarkVCS/%d/Commit;%d%40d ns/op", L, txnLimit, duration.Nanoseconds())
fmt.Println(vc.SEP)
fmt.Println(out)
fmt.Println(vc.SEP)
return out
}
func BenchmarkVCSOpenAll(L uint8, txnLimit uint64) string {
N := uint64(1) << L
K := txnLimit
vcs := vc.VCS{}
vcs.KeyGenLoad(16, L, FOLDER, K)
aFr := vc.GenerateVector(N)
dt := time.Now()
vcs.OpenAll(aFr)
duration := time.Since(dt)
out := fmt.Sprintf("BenchmarkVCS/%d/OpenAll;%d%40d ns/op", L, txnLimit, duration.Nanoseconds())
fmt.Println(vc.SEP)
fmt.Println(out)
fmt.Println(vc.SEP)
return out
}
func Benchmark() {
var ell []uint8
var txns []uint64
var logs []string
txns = []uint64{1024}
for itxn := range txns {
txnLimit := txns[itxn]
ell = []uint8{10, 20, 22, 24, 26} // Change the tree height here
for i := range ell {
l := BenchmarkVCSCommit(ell[i], txnLimit)
logs = append(logs, l)
}
ell = []uint8{10, 20, 22, 24} // Change the tree height here
for i := range ell {
l := BenchmarkVCSOpenAll(ell[i], txnLimit)
logs = append(logs, l)
}
}
fmt.Println(vc.SEP)
for iLog := range logs {
fmt.Println(logs[iLog])
}
fmt.Println(vc.SEP)
}