@@ -30,21 +30,17 @@ func generationBenchmark(amount int) []string {
30
30
kch := make (chan generator.KeyGenerator )
31
31
keys := make ([]string , 0 )
32
32
started := time .Now ()
33
- count := 0
34
33
for i := 0 ; i < amount ; i ++ {
35
- count ++
36
34
go generator .Generate (oem , kch )
37
35
k := <- kch
38
36
keys = append (keys , k .String ())
39
37
}
40
38
for i := 0 ; i < amount ; i ++ {
41
- count ++
42
39
go generator .Generate (cd , kch )
43
40
k := <- kch
44
41
keys = append (keys , k .String ())
45
42
}
46
43
for i := 0 ; i < amount ; i ++ {
47
- count ++
48
44
go generator .Generate (ecd , kch )
49
45
k := <- kch
50
46
keys = append (keys , k .String ())
@@ -57,18 +53,13 @@ func generationBenchmark(amount int) []string {
57
53
default :
58
54
ended = time .Since (started ).Round (time .Microsecond )
59
55
}
60
- switch {
61
- case count > 1 :
62
- fmt .Printf ("Took %s to generate %d keys.\n " , ended , count )
63
- case count == 1 :
64
- fmt .Printf ("Took %s to generate %d key.\n " , ended , count )
65
- }
56
+ fmt .Printf ("Took %s to generate %d keys.\n " , ended , len (keys ))
66
57
67
58
return keys
68
59
}
69
60
70
61
// generationBenchmark validates N keys and times it.
71
- func validationBenchmark (keys []string , count int ) {
62
+ func validationBenchmark (keys []string ) {
72
63
vch := make (chan bool )
73
64
var ki validator.KeyValidator
74
65
started := time .Now ()
@@ -98,12 +89,6 @@ func validationBenchmark(keys []string, count int) {
98
89
default :
99
90
ended = time .Since (started ).Round (time .Microsecond )
100
91
}
101
- switch {
102
- case count > 1 :
103
- fmt .Printf ("Took %s to validate %d keys.\n " , ended , count )
104
- return
105
- case count == 1 :
106
- fmt .Printf ("Took %s to validate %d key.\n " , ended , count )
107
- return
108
- }
92
+
93
+ fmt .Printf ("Took %s to validate %d keys.\n " , ended , len (keys ))
109
94
}
0 commit comments