Commit f7dbc73e authored by Thomas Hoffmann's avatar Thomas Hoffmann
Browse files

Expanded benchmarks

parent 46f31fa3
......@@ -66,22 +66,30 @@ func benchmarkBallots(votecount, serverCount, reqServer int, b *testing.B) {
}
//Variable n
func BenchmarkBallotsServer(b *testing.B) {
func BenchmarkClientServer(b *testing.B) {
log.SetOutput(ioutil.Discard)
b.Run("9 of 9 servers", func(b *testing.B) { benchmarkBallots(1, 9, 9, b) })
b.Run("9 of 10 servers", func(b *testing.B) { benchmarkBallots(1, 10, 9, b) })
b.Run("9 of 11 servers", func(b *testing.B) { benchmarkBallots(1, 11, 9, b) })
b.Run("9 of 12 servers", func(b *testing.B) { benchmarkBallots(1, 12, 9, b) })
b.Run("9 of 13 servers", func(b *testing.B) { benchmarkBallots(1, 13, 9, b) })
b.Run("9 of 14 servers", func(b *testing.B) { benchmarkBallots(1, 14, 9, b) })
b.Run("9 of 15 servers", func(b *testing.B) { benchmarkBallots(1, 15, 9, b) })
b.Run("9 of 16 servers", func(b *testing.B) { benchmarkBallots(1, 16, 9, b) })
b.Run("9 of 17 servers", func(b *testing.B) { benchmarkBallots(1, 17, 9, b) })
}
//Variable t
func BenchmarkBallotsTrusted(b *testing.B) {
func BenchmarkClientThreshold(b *testing.B) {
log.SetOutput(ioutil.Discard)
b.Run(" 9 of 17 servers", func(b *testing.B) { benchmarkBallots(1, 17, 9, b) })
b.Run("10 of 17 servers", func(b *testing.B) { benchmarkBallots(1, 17, 10, b) })
b.Run("11 of 17 servers", func(b *testing.B) { benchmarkBallots(1, 17, 11, b) })
b.Run("12 of 17 servers", func(b *testing.B) { benchmarkBallots(1, 17, 12, b) })
b.Run("13 of 17 servers", func(b *testing.B) { benchmarkBallots(1, 17, 13, b) })
b.Run("14 of 17 servers", func(b *testing.B) { benchmarkBallots(1, 17, 14, b) })
b.Run("15 of 17 servers", func(b *testing.B) { benchmarkBallots(1, 17, 15, b) })
b.Run("16 of 17 servers", func(b *testing.B) { benchmarkBallots(1, 17, 16, b) })
b.Run("17 of 17 servers", func(b *testing.B) { benchmarkBallots(1, 17, 17, b) })
}
......@@ -112,7 +120,7 @@ func benchmarkTally(votecount, serverCount, reqServer int, b *testing.B) {
}
}
func BenchmarkBallotVote(b *testing.B) {
func BenchmarkTallyVote(b *testing.B) {
log.SetOutput(ioutil.Discard)
b.Run("10 Votes", func(b *testing.B) { benchmarkTally(10, 5, 3, b) })
b.Run("100 Votes", func(b *testing.B) { benchmarkTally(100, 5, 3, b) })
......@@ -120,20 +128,28 @@ func BenchmarkBallotVote(b *testing.B) {
b.Run("10000 Votes", func(b *testing.B) { benchmarkTally(10000, 5, 3, b) })
b.Run("100000 Votes", func(b *testing.B) { benchmarkTally(100000, 5, 3, b) })
}
func BenchmarkBallotServer(b *testing.B) {
func BenchmarkTallyServer(b *testing.B) {
log.SetOutput(ioutil.Discard)
b.Run("9 of 9 servers", func(b *testing.B) { benchmarkTally(100, 9, 9, b) })
b.Run("9 of 10 servers", func(b *testing.B) { benchmarkTally(100, 10, 9, b) })
b.Run("9 of 11 servers", func(b *testing.B) { benchmarkTally(100, 11, 9, b) })
b.Run("9 of 12 servers", func(b *testing.B) { benchmarkTally(100, 12, 9, b) })
b.Run("9 of 13 servers", func(b *testing.B) { benchmarkTally(100, 13, 9, b) })
b.Run("9 of 14 servers", func(b *testing.B) { benchmarkTally(100, 14, 9, b) })
b.Run("9 of 15 servers", func(b *testing.B) { benchmarkTally(100, 15, 9, b) })
b.Run("9 of 16 servers", func(b *testing.B) { benchmarkTally(100, 16, 9, b) })
b.Run("9 of 17 servers", func(b *testing.B) { benchmarkTally(100, 17, 9, b) })
}
func BenchmarkBallotRequired(b *testing.B) {
func BenchmarkTallyThreshold(b *testing.B) {
log.SetOutput(ioutil.Discard)
b.Run("9 of 17 servers", func(b *testing.B) { benchmarkTally(100, 17, 9, b) })
b.Run("10 of 17 servers", func(b *testing.B) { benchmarkTally(100, 17, 10, b) })
b.Run("11 of 17 servers", func(b *testing.B) { benchmarkTally(100, 17, 11, b) })
b.Run("12 of 17 servers", func(b *testing.B) { benchmarkTally(100, 17, 12, b) })
b.Run("13 of 17 servers", func(b *testing.B) { benchmarkTally(100, 17, 13, b) })
b.Run("14 of 17 servers", func(b *testing.B) { benchmarkTally(100, 17, 14, b) })
b.Run("15 of 17 servers", func(b *testing.B) { benchmarkTally(100, 17, 15, b) })
b.Run("16 of 17 servers", func(b *testing.B) { benchmarkTally(100, 17, 16, b) })
b.Run("17 of 17 servers", func(b *testing.B) { benchmarkTally(100, 17, 17, b) })
}
......@@ -194,19 +210,34 @@ func BenchmarkCombineVote(b *testing.B) {
}
func BenchmarkCombineServer(b *testing.B) {
log.SetOutput(ioutil.Discard)
b.Run("9 of 9 servers", func(b *testing.B) { benchmarkCombine(100, 9, 9, b) })
b.Run("9 of 11 servers", func(b *testing.B) { benchmarkCombine(100, 11, 9, b) })
b.Run("9 of 13 servers", func(b *testing.B) { benchmarkCombine(100, 13, 9, b) })
b.Run("9 of 15 servers", func(b *testing.B) { benchmarkCombine(100, 15, 9, b) })
b.Run("9 of 17 servers", func(b *testing.B) { benchmarkCombine(100, 17, 9, b) })
b.Run("15 of 15 servers", func(b *testing.B) { benchmarkCombine(100, 15, 15, b) })
b.Run("15 of 16 servers", func(b *testing.B) { benchmarkCombine(100, 16, 15, b) })
b.Run("15 of 17 servers", func(b *testing.B) { benchmarkCombine(100, 17, 15, b) })
b.Run("15 of 18 servers", func(b *testing.B) { benchmarkCombine(100, 18, 15, b) })
b.Run("15 of 19 servers", func(b *testing.B) { benchmarkCombine(100, 19, 15, b) })
b.Run("15 of 20 servers", func(b *testing.B) { benchmarkCombine(100, 20, 15, b) })
b.Run("15 of 21 servers", func(b *testing.B) { benchmarkCombine(100, 21, 15, b) })
b.Run("15 of 22 servers", func(b *testing.B) { benchmarkCombine(100, 22, 15, b) })
b.Run("15 of 23 servers", func(b *testing.B) { benchmarkCombine(100, 23, 15, b) })
b.Run("15 of 24 servers", func(b *testing.B) { benchmarkCombine(100, 24, 15, b) })
b.Run("15 of 25 servers", func(b *testing.B) { benchmarkCombine(100, 25, 15, b) })
b.Run("15 of 26 servers", func(b *testing.B) { benchmarkCombine(100, 26, 15, b) })
b.Run("15 of 27 servers", func(b *testing.B) { benchmarkCombine(100, 27, 15, b) })
b.Run("15 of 28 servers", func(b *testing.B) { benchmarkCombine(100, 28, 15, b) })
b.Run("15 of 29 servers", func(b *testing.B) { benchmarkCombine(100, 29, 15, b) })
}
func BenchmarkCombineRequired(b *testing.B) {
func BenchmarkCombineThreshold(b *testing.B) {
log.SetOutput(ioutil.Discard)
b.Run("9 of 17 servers", func(b *testing.B) { benchmarkCombine(100, 17, 9, b) })
b.Run("10 of 17 servers", func(b *testing.B) { benchmarkCombine(100, 17, 10, b) })
b.Run("11 of 17 servers", func(b *testing.B) { benchmarkCombine(100, 17, 11, b) })
b.Run("12 of 17 servers", func(b *testing.B) { benchmarkCombine(100, 17, 12, b) })
b.Run("13 of 17 servers", func(b *testing.B) { benchmarkCombine(100, 17, 13, b) })
b.Run("14 of 17 servers", func(b *testing.B) { benchmarkCombine(100, 17, 14, b) })
b.Run("15 of 17 servers", func(b *testing.B) { benchmarkCombine(100, 17, 15, b) })
b.Run("16 of 17 servers", func(b *testing.B) { benchmarkCombine(100, 17, 16, b) })
b.Run("17 of 17 servers", func(b *testing.B) { benchmarkCombine(100, 17, 17, b) })
}
// Actual tests
......@@ -415,6 +446,7 @@ func TestCloseTimeout(t *testing.T) {
func TestCloseTimeoutTally(t *testing.T) {
_ = testElection(t, PhaseTallying, func(e *Election) <-chan time.Time {
log.SetOutput(os.Stdout)
e.Status.Phase = PhaseCollect
e.Config.CloseSleep = 1 * time.Second
......@@ -463,7 +495,6 @@ func TestCloseTimeoutSkipTally(t *testing.T) {
func TestCloseTimeoutLateBallot(t *testing.T) {
_ = testElection(t, PhaseClosed, func(e *Election) <-chan time.Time {
log.SetOutput(os.Stdout)
e.Status.Phase = PhaseCollect
e.Config.CloseSleep = 500 * time.Millisecond
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment