From 72086f913c5efbc1bf9909d63eb7478031475538 Mon Sep 17 00:00:00 2001 From: matteosz Date: Sun, 10 Mar 2024 09:44:57 +0100 Subject: [PATCH] Changed benchmark structure --- Makefile | 4 ---- benchmark/.gitignore | 1 - benchmark/bls/benchmark.sh | 19 ------------------- benchmark/run.sh | 15 --------------- .../bls12381/bls12381_test.go | 7 +++---- .../{ => bls12381}/circl_bls12381/adapter.go | 0 .../circl_bls12381/adapter_test.go | 0 pairing/{ => bls12381}/circl_bls12381/g1.go | 0 pairing/{ => bls12381}/circl_bls12381/g2.go | 0 .../{ => bls12381}/circl_bls12381/group.go | 0 pairing/{ => bls12381}/circl_bls12381/gt.go | 0 .../{ => bls12381}/circl_bls12381/scalar.go | 0 .../{ => bls12381}/circl_bls12381/suite.go | 0 .../circl_bls12381/suite_test.go | 2 +- .../{ => bls12381}/kilic_bls12381/adapter.go | 0 .../kilic_bls12381/adapter_test.go | 0 pairing/{ => bls12381}/kilic_bls12381/g1.go | 0 pairing/{ => bls12381}/kilic_bls12381/g2.go | 0 .../{ => bls12381}/kilic_bls12381/group.go | 0 pairing/{ => bls12381}/kilic_bls12381/gt.go | 0 .../{ => bls12381}/kilic_bls12381/scalar.go | 0 .../{ => bls12381}/kilic_bls12381/suite.go | 0 .../kilic_bls12381/suite_test.go | 0 sign/test/bls_test.go | 2 +- 24 files changed, 5 insertions(+), 45 deletions(-) delete mode 100644 benchmark/.gitignore delete mode 100755 benchmark/bls/benchmark.sh delete mode 100755 benchmark/run.sh rename benchmark/bls/benchmark_test.go => pairing/bls12381/bls12381_test.go (95%) rename pairing/{ => bls12381}/circl_bls12381/adapter.go (100%) rename pairing/{ => bls12381}/circl_bls12381/adapter_test.go (100%) rename pairing/{ => bls12381}/circl_bls12381/g1.go (100%) rename pairing/{ => bls12381}/circl_bls12381/g2.go (100%) rename pairing/{ => bls12381}/circl_bls12381/group.go (100%) rename pairing/{ => bls12381}/circl_bls12381/gt.go (100%) rename pairing/{ => bls12381}/circl_bls12381/scalar.go (100%) rename pairing/{ => bls12381}/circl_bls12381/suite.go (100%) rename pairing/{ => bls12381}/circl_bls12381/suite_test.go (99%) rename pairing/{ => bls12381}/kilic_bls12381/adapter.go (100%) rename pairing/{ => bls12381}/kilic_bls12381/adapter_test.go (100%) rename pairing/{ => bls12381}/kilic_bls12381/g1.go (100%) rename pairing/{ => bls12381}/kilic_bls12381/g2.go (100%) rename pairing/{ => bls12381}/kilic_bls12381/group.go (100%) rename pairing/{ => bls12381}/kilic_bls12381/gt.go (100%) rename pairing/{ => bls12381}/kilic_bls12381/scalar.go (100%) rename pairing/{ => bls12381}/kilic_bls12381/suite.go (100%) rename pairing/{ => bls12381}/kilic_bls12381/suite_test.go (100%) diff --git a/Makefile b/Makefile index ebbaf131c..f5b2c46aa 100644 --- a/Makefile +++ b/Makefile @@ -25,7 +25,3 @@ coverage: tidy # pushing code check: lint vet test echo "check done" - -benchmark: tidy - chmod +x benchmark/run.sh - cd benchmark && ./run.sh diff --git a/benchmark/.gitignore b/benchmark/.gitignore deleted file mode 100644 index 314f02b1b..000000000 --- a/benchmark/.gitignore +++ /dev/null @@ -1 +0,0 @@ -*.txt \ No newline at end of file diff --git a/benchmark/bls/benchmark.sh b/benchmark/bls/benchmark.sh deleted file mode 100755 index 715d1e74f..000000000 --- a/benchmark/bls/benchmark.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash -# It runs the benchmark for the kilic and circl implementations and use benchstat to compare the results. - -rounds=1 - -# Run the benchmark for the kilic implementation -go test -bench=Kilic -run=^$ -count=$rounds > kilic.txt & - -# Run in parallel the benchmark for the circl implementation -go test -bench=Circl -run=^$ -count=$rounds > circl.txt & - -wait -echo "Benchmark results for bls are ready." - -# Compare the results -benchstat circl.txt kilic.txt > ../results/bls_comparison.txt - -# Delete the temporary files -rm kilic.txt circl.txt \ No newline at end of file diff --git a/benchmark/run.sh b/benchmark/run.sh deleted file mode 100755 index 06041fdcf..000000000 --- a/benchmark/run.sh +++ /dev/null @@ -1,15 +0,0 @@ -# Execute all the benchmarks.sh contained in the subfolders - -# Get the list of all the subfolders -SUBDIRS=$(find . -mindepth 1 -maxdepth 1 -type d -exec test -e '{}/benchmark.sh' ';' -print) - -# Run all the benchmarks -for subdir in $SUBDIRS; do - cd $subdir - echo "Running benchmark for $subdir..." - chmod +x benchmark.sh - ./benchmark.sh - cd .. -done - -echo "All benchmarks have been executed." \ No newline at end of file diff --git a/benchmark/bls/benchmark_test.go b/pairing/bls12381/bls12381_test.go similarity index 95% rename from benchmark/bls/benchmark_test.go rename to pairing/bls12381/bls12381_test.go index 3fa58204b..acb424b1f 100644 --- a/benchmark/bls/benchmark_test.go +++ b/pairing/bls12381/bls12381_test.go @@ -1,5 +1,4 @@ -// Forked from https://github.com/matejpavlovic/bls-bench -package benchmark +package bls12381 import ( "crypto/rand" @@ -8,8 +7,8 @@ import ( "go.dedis.ch/kyber/v3" "go.dedis.ch/kyber/v3/pairing" - circlBls12381 "go.dedis.ch/kyber/v3/pairing/circl_bls12381" - kilicBls12381 "go.dedis.ch/kyber/v3/pairing/kilic_bls12381" + circlBls12381 "go.dedis.ch/kyber/v3/pairing/bls12381/circl_bls12381" + kilicBls12381 "go.dedis.ch/kyber/v3/pairing/bls12381/kilic_bls12381" "go.dedis.ch/kyber/v3/sign/bls" "go.dedis.ch/kyber/v3/util/random" ) diff --git a/pairing/circl_bls12381/adapter.go b/pairing/bls12381/circl_bls12381/adapter.go similarity index 100% rename from pairing/circl_bls12381/adapter.go rename to pairing/bls12381/circl_bls12381/adapter.go diff --git a/pairing/circl_bls12381/adapter_test.go b/pairing/bls12381/circl_bls12381/adapter_test.go similarity index 100% rename from pairing/circl_bls12381/adapter_test.go rename to pairing/bls12381/circl_bls12381/adapter_test.go diff --git a/pairing/circl_bls12381/g1.go b/pairing/bls12381/circl_bls12381/g1.go similarity index 100% rename from pairing/circl_bls12381/g1.go rename to pairing/bls12381/circl_bls12381/g1.go diff --git a/pairing/circl_bls12381/g2.go b/pairing/bls12381/circl_bls12381/g2.go similarity index 100% rename from pairing/circl_bls12381/g2.go rename to pairing/bls12381/circl_bls12381/g2.go diff --git a/pairing/circl_bls12381/group.go b/pairing/bls12381/circl_bls12381/group.go similarity index 100% rename from pairing/circl_bls12381/group.go rename to pairing/bls12381/circl_bls12381/group.go diff --git a/pairing/circl_bls12381/gt.go b/pairing/bls12381/circl_bls12381/gt.go similarity index 100% rename from pairing/circl_bls12381/gt.go rename to pairing/bls12381/circl_bls12381/gt.go diff --git a/pairing/circl_bls12381/scalar.go b/pairing/bls12381/circl_bls12381/scalar.go similarity index 100% rename from pairing/circl_bls12381/scalar.go rename to pairing/bls12381/circl_bls12381/scalar.go diff --git a/pairing/circl_bls12381/suite.go b/pairing/bls12381/circl_bls12381/suite.go similarity index 100% rename from pairing/circl_bls12381/suite.go rename to pairing/bls12381/circl_bls12381/suite.go diff --git a/pairing/circl_bls12381/suite_test.go b/pairing/bls12381/circl_bls12381/suite_test.go similarity index 99% rename from pairing/circl_bls12381/suite_test.go rename to pairing/bls12381/circl_bls12381/suite_test.go index 7ae98eb5d..3e0382c99 100644 --- a/pairing/circl_bls12381/suite_test.go +++ b/pairing/bls12381/circl_bls12381/suite_test.go @@ -8,7 +8,7 @@ import ( "github.com/stretchr/testify/require" "go.dedis.ch/kyber/v3" - this "go.dedis.ch/kyber/v3/pairing/circl_bls12381" + this "go.dedis.ch/kyber/v3/pairing/bls12381/circl_bls12381" "go.dedis.ch/kyber/v3/sign/bls" "go.dedis.ch/kyber/v3/sign/tbls" "go.dedis.ch/kyber/v3/sign/test" diff --git a/pairing/kilic_bls12381/adapter.go b/pairing/bls12381/kilic_bls12381/adapter.go similarity index 100% rename from pairing/kilic_bls12381/adapter.go rename to pairing/bls12381/kilic_bls12381/adapter.go diff --git a/pairing/kilic_bls12381/adapter_test.go b/pairing/bls12381/kilic_bls12381/adapter_test.go similarity index 100% rename from pairing/kilic_bls12381/adapter_test.go rename to pairing/bls12381/kilic_bls12381/adapter_test.go diff --git a/pairing/kilic_bls12381/g1.go b/pairing/bls12381/kilic_bls12381/g1.go similarity index 100% rename from pairing/kilic_bls12381/g1.go rename to pairing/bls12381/kilic_bls12381/g1.go diff --git a/pairing/kilic_bls12381/g2.go b/pairing/bls12381/kilic_bls12381/g2.go similarity index 100% rename from pairing/kilic_bls12381/g2.go rename to pairing/bls12381/kilic_bls12381/g2.go diff --git a/pairing/kilic_bls12381/group.go b/pairing/bls12381/kilic_bls12381/group.go similarity index 100% rename from pairing/kilic_bls12381/group.go rename to pairing/bls12381/kilic_bls12381/group.go diff --git a/pairing/kilic_bls12381/gt.go b/pairing/bls12381/kilic_bls12381/gt.go similarity index 100% rename from pairing/kilic_bls12381/gt.go rename to pairing/bls12381/kilic_bls12381/gt.go diff --git a/pairing/kilic_bls12381/scalar.go b/pairing/bls12381/kilic_bls12381/scalar.go similarity index 100% rename from pairing/kilic_bls12381/scalar.go rename to pairing/bls12381/kilic_bls12381/scalar.go diff --git a/pairing/kilic_bls12381/suite.go b/pairing/bls12381/kilic_bls12381/suite.go similarity index 100% rename from pairing/kilic_bls12381/suite.go rename to pairing/bls12381/kilic_bls12381/suite.go diff --git a/pairing/kilic_bls12381/suite_test.go b/pairing/bls12381/kilic_bls12381/suite_test.go similarity index 100% rename from pairing/kilic_bls12381/suite_test.go rename to pairing/bls12381/kilic_bls12381/suite_test.go diff --git a/sign/test/bls_test.go b/sign/test/bls_test.go index fe034919b..48e118d30 100644 --- a/sign/test/bls_test.go +++ b/sign/test/bls_test.go @@ -3,7 +3,7 @@ package test import ( "testing" - bls "go.dedis.ch/kyber/v3/pairing/kilic_bls12381" + bls "go.dedis.ch/kyber/v3/pairing/bls12381/kilic_bls12381" sign "go.dedis.ch/kyber/v3/sign/bls" )