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

Fix benchmarks

parent 3a9229f3
Pipeline #22008 passed with stages
in 1 minute and 39 seconds
......@@ -18,6 +18,25 @@ import (
"github.com/google/uuid"
)
func primes(bit string) (string, string) {
switch bit {
case "16":
return "C047", "6023"
case "32":
return "E0885DBF", "70442EDF"
case "64":
return "D74913FAF3F964EF", "6BA489FD79FCB277"
case "128":
return "F213D1D3FCB695A327DACA080380F5B7", "7909E8E9FE5B4AD193ED650401C07ADB"
case "256":
return "FB6E2B44AC03CE014942C38631E31810C18B97B8C1110DB6DC698CB71AE9A65F", "7DB715A25601E700A4A161C318F18C0860C5CBDC608886DB6E34C65B8D74D32F"
case "512":
return "E5F3ADA593237B17A587FCC4AF32F72DC75CAA3E97C256F599303EB1B855CC4229E0C80B20A361C44CF4F45E28828A734BA1AEFF0D90C6880E6A9DF640D058F7", "72F9D6D2C991BD8BD2C3FE6257997B96E3AE551F4BE12B7ACC981F58DC2AE62114F064059051B0E2267A7A2F14414539A5D0D77F86C8634407354EFB20682C7B"
default:
return "", ""
}
}
/////////////////////
///Setup functions///
/////////////////////
......@@ -143,7 +162,7 @@ func BenchmarkClientThreshold(b *testing.B) {
func benchmarkTally(params *common.Params, votecount, serverCount, reqServer int, b *testing.B) {
//Setup
b.StopTimer()
box := NewBallotBox(big.NewInt(1), benchConfig())
box := NewBallotBox(big.NewInt(1), params)
id := UniqueID("1")
for i := 0; i < votecount; i++ {
......@@ -228,7 +247,7 @@ func benchmarkCombine(params *common.Params, votecount, serverCount, reqServer i
tallyBoxes := make([]*TallyBox, serverCount)
for i := 0; i < serverCount; i++ {
tallyBoxes[i] = NewTallyBox(params)
ballotBoxes[i] = NewBallotBox(xs[i], benchConfig())
ballotBoxes[i] = NewBallotBox(xs[i], params)
}
for i, ballotbox := range ballotBoxes {
......@@ -322,88 +341,50 @@ func BenchmarkCombineOptimal(b *testing.B) {
func BenchmarkClientConfig(b *testing.B) {
log.SetOutput(ioutil.Discard)
//var config *common.Params
config := createConfig(
"C047",
"6023")
config := createConfig(primes("16"))
b.Run(" 16-bit", func(b *testing.B) { benchmarkBallots(config, 10, 17, 9, b) })
config = createConfig(
"E0885DBF",
"70442EDF")
config = createConfig(primes("32"))
b.Run(" 32-bit", func(b *testing.B) { benchmarkBallots(config, 10, 17, 9, b) })
config = createConfig(
"D74913FAF3F964EF",
"6BA489FD79FCB277")
config = createConfig(primes("64"))
b.Run(" 64-bit", func(b *testing.B) { benchmarkBallots(config, 10, 17, 9, b) })
config = createConfig(
"F213D1D3FCB695A327DACA080380F5B7",
"7909E8E9FE5B4AD193ED650401C07ADB")
config = createConfig(primes("128"))
b.Run("128-bit", func(b *testing.B) { benchmarkBallots(config, 10, 17, 9, b) })
config = createConfig(
"FB6E2B44AC03CE014942C38631E31810C18B97B8C1110DB6DC698CB71AE9A65F",
"7DB715A25601E700A4A161C318F18C0860C5CBDC608886DB6E34C65B8D74D32F")
config = createConfig(primes("256"))
b.Run("256-bit", func(b *testing.B) { benchmarkBallots(config, 10, 17, 9, b) })
config = createConfig(
"E5F3ADA593237B17A587FCC4AF32F72DC75CAA3E97C256F599303EB1B855CC4229E0C80B20A361C44CF4F45E28828A734BA1AEFF0D90C6880E6A9DF640D058F7",
"72F9D6D2C991BD8BD2C3FE6257997B96E3AE551F4BE12B7ACC981F58DC2AE62114F064059051B0E2267A7A2F14414539A5D0D77F86C8634407354EFB20682C7B")
config = createConfig(primes("512"))
b.Run("512-bit", func(b *testing.B) { benchmarkBallots(config, 10, 17, 9, b) })
}
func BenchmarkTallyConfig(b *testing.B) {
log.SetOutput(ioutil.Discard)
//var config *common.Params
config := createConfig(
"C047",
"6023")
config := createConfig(primes("16"))
b.Run(" 16-bit", func(b *testing.B) { benchmarkTally(config, 10, 17, 9, b) })
config = createConfig(
"E0885DBF",
"70442EDF")
//b.Run(" 32-bit", func(b *testing.B) { benchmarkTally(config, 10, 17, 9, b) })
config = createConfig(
"FB89DEBCFA04CC3F",
"7DC4EF5E7D02661F")
//b.Run(" 64-bit", func(b *testing.B) { benchmarkTally(config, 10, 17, 9, b) })
config = createConfig(
"F213D1D3FCB695A327DACA080380F5B7",
"7909E8E9FE5B4AD193ED650401C07ADB")
//b.Run("128-bit", func(b *testing.B) { benchmarkTally(config, 10, 17, 9, b) })
config = createConfig(
"FB6E2B44AC03CE014942C38631E31810C18B97B8C1110DB6DC698CB71AE9A65F",
"7DB715A25601E700A4A161C318F18C0860C5CBDC608886DB6E34C65B8D74D32F")
//b.Run("256-bit", func(b *testing.B) { benchmarkTally(config, 10, 17, 9, b) })
config = createConfig(
"E5F3ADA593237B17A587FCC4AF32F72DC75CAA3E97C256F599303EB1B855CC4229E0C80B20A361C44CF4F45E28828A734BA1AEFF0D90C6880E6A9DF640D058F7",
"72F9D6D2C991BD8BD2C3FE6257997B96E3AE551F4BE12B7ACC981F58DC2AE62114F064059051B0E2267A7A2F14414539A5D0D77F86C8634407354EFB20682C7B")
//b.Run("512-bit", func(b *testing.B) { benchmarkTally(config, 10, 17, 9, b) })
config = createConfig(primes("32"))
b.Run(" 32-bit", func(b *testing.B) { benchmarkTally(config, 10, 17, 9, b) })
config = createConfig(primes("64"))
b.Run(" 64-bit", func(b *testing.B) { benchmarkTally(config, 10, 17, 9, b) })
config = createConfig(primes("128"))
b.Run("128-bit", func(b *testing.B) { benchmarkTally(config, 10, 17, 9, b) })
config = createConfig(primes("256"))
b.Run("256-bit", func(b *testing.B) { benchmarkTally(config, 10, 17, 9, b) })
config = createConfig(primes("512"))
b.Run("512-bit", func(b *testing.B) { benchmarkTally(config, 10, 17, 9, b) })
}
func BenchmarkCombineConfig(b *testing.B) {
log.SetOutput(ioutil.Discard)
var config *common.Params
config = createConfig(
"DF37",
"6F9B")
config = createConfig(primes("16"))
b.Run(" 16-bit", func(b *testing.B) { benchmarkCombine(config, 10, 17, 9, b) })
config = createConfig(
"E0885DBF",
"70442EDF")
config = createConfig(primes("32"))
b.Run(" 32-bit", func(b *testing.B) { benchmarkCombine(config, 10, 17, 9, b) })
config = createConfig(
"EB8AB7FE77FF3663",
"75C55BFF3BFF9B31")
config = createConfig(primes("64"))
b.Run(" 64-bit", func(b *testing.B) { benchmarkCombine(config, 10, 17, 9, b) })
config = createConfig(
"EBDD3B1ADF5E595C977667F3CBDECD13",
"75EE9D8D6FAF2CAE4BBB33F9E5EF6689")
config = createConfig(primes("128"))
b.Run("128-bit", func(b *testing.B) { benchmarkCombine(config, 10, 17, 9, b) })
config = createConfig(
"FB6E2B44AC03CE014942C38631E31810C18B97B8C1110DB6DC698CB71AE9A65F",
"7DB715A25601E700A4A161C318F18C0860C5CBDC608886DB6E34C65B8D74D32F")
config = createConfig(primes("256"))
b.Run("256-bit", func(b *testing.B) { benchmarkCombine(config, 10, 17, 9, b) })
config = createConfig(
"E5F3ADA593237B17A587FCC4AF32F72DC75CAA3E97C256F599303EB1B855CC4229E0C80B20A361C44CF4F45E28828A734BA1AEFF0D90C6880E6A9DF640D058F7",
"72F9D6D2C991BD8BD2C3FE6257997B96E3AE551F4BE12B7ACC981F58DC2AE62114F064059051B0E2267A7A2F14414539A5D0D77F86C8634407354EFB20682C7B")
config = createConfig(primes("512"))
b.Run("512-bit", func(b *testing.B) { benchmarkCombine(config, 10, 17, 9, b) })
}
......
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