Skip to content

Commit

Permalink
remove bls mul ops from benchmark subcommand
Browse files Browse the repository at this point in the history
Signed-off-by: garyschulte <[email protected]>
  • Loading branch information
garyschulte committed Dec 20, 2024
1 parent 5a778af commit 32106bc
Showing 1 changed file with 0 additions and 48 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,8 @@
import org.hyperledger.besu.evm.EvmSpecVersion;
import org.hyperledger.besu.evm.precompile.AbstractBLS12PrecompiledContract;
import org.hyperledger.besu.evm.precompile.BLS12G1AddPrecompiledContract;
import org.hyperledger.besu.evm.precompile.BLS12G1MulPrecompiledContract;
import org.hyperledger.besu.evm.precompile.BLS12G1MultiExpPrecompiledContract;
import org.hyperledger.besu.evm.precompile.BLS12G2AddPrecompiledContract;
import org.hyperledger.besu.evm.precompile.BLS12G2MulPrecompiledContract;
import org.hyperledger.besu.evm.precompile.BLS12G2MultiExpPrecompiledContract;
import org.hyperledger.besu.evm.precompile.BLS12MapFp2ToG2PrecompiledContract;
import org.hyperledger.besu.evm.precompile.BLS12MapFpToG1PrecompiledContract;
Expand Down Expand Up @@ -166,11 +164,9 @@ public void runBenchmark(
}

benchmarkG1Add(output);
benchmarkG1Mul(output);
benchmarkG1MultiExp32Pairs(output);
benchmarkMapFpToG1(output);
benchmarkG2Add(output);
benchmarkG2Mul(output);
benchmarkG2MultiExp32Pairs(output);
benchmarkMapFp2ToG2(output);
benchmarkBlsPairing(output);
Expand Down Expand Up @@ -198,28 +194,6 @@ private void benchmarkG1Add(final PrintStream output) {
gasCost, execTime * 1_000_000, gasCost / execTime / 1_000_000);
}

private void benchmarkG1Mul(final PrintStream output) {
final Map<String, Bytes> testCases = new LinkedHashMap<>();
for (int i = 0; i < g1PointPairs.length; i++) {
testCases.put("G1 Mul " + i, Bytes.fromHexString(g1PointPairs[i] + scalars[i]));
}

BLS12G1MulPrecompiledContract g1addContract = new BLS12G1MulPrecompiledContract();
warmup = MATH_WARMUP / testCases.size();
iterations = MATH_ITERATIONS / testCases.size();
double execTime = Double.MIN_VALUE; // a way to dodge divide by zero
long gasCost = 0;
for (final Map.Entry<String, Bytes> testCase : testCases.entrySet()) {
execTime += runPrecompileBenchmark(testCase.getValue(), g1addContract);
gasCost += g1addContract.gasRequirement(testCase.getValue());
}
execTime /= testCases.size();
gasCost /= testCases.size();
output.printf(
"Bls12 G1 Mul %,6d avg gas @%,7.1f µs /%,8.1f MGps%n",
gasCost, execTime * 1_000_000, gasCost / execTime / 1_000_000);
}

private void benchmarkG1MultiExp32Pairs(final PrintStream output) {
final Map<String, Bytes> testCases = new LinkedHashMap<>();

Expand Down Expand Up @@ -290,28 +264,6 @@ private void benchmarkG2Add(final PrintStream output) {
gasCost, execTime * 1_000_000, gasCost / execTime / 1_000_000);
}

private void benchmarkG2Mul(final PrintStream output) {
final Map<String, Bytes> testCases = new LinkedHashMap<>();
for (int i = 0; i < g2PointPairs.length; i++) {
testCases.put("G2 Mul " + i, Bytes.fromHexString(g2PointPairs[i] + scalars[i]));
}

BLS12G2MulPrecompiledContract g1addContract = new BLS12G2MulPrecompiledContract();
warmup = MATH_WARMUP / testCases.size();
iterations = MATH_ITERATIONS / testCases.size();
double execTime = Double.MIN_VALUE; // a way to dodge divide by zero
long gasCost = 0;
for (final Map.Entry<String, Bytes> testCase : testCases.entrySet()) {
execTime += runPrecompileBenchmark(testCase.getValue(), g1addContract);
gasCost += g1addContract.gasRequirement(testCase.getValue());
}
execTime /= testCases.size();
gasCost /= testCases.size();
output.printf(
"Bls12 G2 Mul %,6d avg gas @%,7.1f µs /%,8.1f MGps%n",
gasCost, execTime * 1_000_000, gasCost / execTime / 1_000_000);
}

private void benchmarkG2MultiExp32Pairs(final PrintStream output) {
final Map<String, Bytes> testCases = new LinkedHashMap<>();

Expand Down

0 comments on commit 32106bc

Please sign in to comment.