Present results as a table
This commit is contained in:
parent
a207c23f3e
commit
e356bd1b37
23
README.md
23
README.md
|
@ -91,19 +91,16 @@ The API is identical for all implementations.
|
||||||
- `herumi`: [src/herumi](src/herumi)
|
- `herumi`: [src/herumi](src/herumi)
|
||||||
- `noble`: [noble-bls12-381](https://github.com/paulmillr/noble-bls12-381)
|
- `noble`: [noble-bls12-381](https://github.com/paulmillr/noble-bls12-381)
|
||||||
|
|
||||||
```
|
Results are in `ops/sec`. `blst` and `herumi` performed 100 runs each, `noble` 10 runs.
|
||||||
blst verify: 502.72 ops/sec (100 runs)
|
|
||||||
blst verifyAgg: 489.60 ops/sec (100 runs)
|
| Function - `ops/sec` | `blst` | `herumi` | `noble`\* |
|
||||||
blst aggPubkey: 8326.6 ops/sec (100 runs)
|
| ------------------------- | :----: | :------: | :-------: |
|
||||||
blst aggSigs: 6968.3 ops/sec (100 runs)
|
| `verify` | 502.72 | 53.792 | 13.868 |
|
||||||
herumi verify: 53.792 ops/sec (100 runs)
|
| `verifyAggregate` (30) | 489.60 | 52.897 | 11.241 |
|
||||||
herumi verifyAgg: 52.897 ops/sec (100 runs)
|
| `aggregate` (pubkeys, 30) | 8326.6 | 3020.1 | 47.309 |
|
||||||
herumi aggPubkey: 3020.1 ops/sec (100 runs)
|
| `aggregate` (sigs, 30) | 6968.3 | 1151.2 | - |
|
||||||
herumi aggSigs: 1151.2 ops/sec (100 runs)
|
|
||||||
noble verify: 13.868 ops/sec (10 runs)
|
\*`noble` methods include serialization and deserialization to bytes, which may impact the `aggregate` benchmark
|
||||||
noble verifyAgg: 11.241 ops/sec (10 runs)
|
|
||||||
noble aggPubkey: 47.309 ops/sec (10 runs)
|
|
||||||
```
|
|
||||||
|
|
||||||
Results from CI run https://github.com/ChainSafe/bls/runs/1478915060
|
Results from CI run https://github.com/ChainSafe/bls/runs/1478915060
|
||||||
|
|
||||||
|
|
|
@ -2,8 +2,7 @@ import {runBenchmark} from "./runner";
|
||||||
import {runForAllImplementations} from "../test/switch";
|
import {runForAllImplementations} from "../test/switch";
|
||||||
import {PublicKey, Signature} from "../src/interface";
|
import {PublicKey, Signature} from "../src/interface";
|
||||||
import {range, randomMessage} from "../test/util";
|
import {range, randomMessage} from "../test/util";
|
||||||
|
import {aggCount, runs} from "./params";
|
||||||
const aggCount = 30;
|
|
||||||
|
|
||||||
(async function () {
|
(async function () {
|
||||||
await runForAllImplementations(async (bls, implementation) => {
|
await runForAllImplementations(async (bls, implementation) => {
|
||||||
|
@ -25,12 +24,13 @@ const aggCount = 30;
|
||||||
testRunner: ({pk, msg, sig}) => {
|
testRunner: ({pk, msg, sig}) => {
|
||||||
return sig.verify(pk, msg);
|
return sig.verify(pk, msg);
|
||||||
},
|
},
|
||||||
|
runs,
|
||||||
});
|
});
|
||||||
|
|
||||||
// Fast aggregate
|
// Fast aggregate
|
||||||
|
|
||||||
await runBenchmark<{pks: PublicKey[]; msg: Uint8Array; sig: Signature}, boolean>({
|
await runBenchmark<{pks: PublicKey[]; msg: Uint8Array; sig: Signature}, boolean>({
|
||||||
id: `${implementation} verifyAggregate`,
|
id: `${implementation} verifyAggregate (${aggCount})`,
|
||||||
|
|
||||||
prepareTest: () => {
|
prepareTest: () => {
|
||||||
const msg = randomMessage();
|
const msg = randomMessage();
|
||||||
|
@ -52,6 +52,7 @@ const aggCount = 30;
|
||||||
testRunner: ({pks, msg, sig}) => {
|
testRunner: ({pks, msg, sig}) => {
|
||||||
return sig.verifyAggregate(pks, msg);
|
return sig.verifyAggregate(pks, msg);
|
||||||
},
|
},
|
||||||
|
runs,
|
||||||
});
|
});
|
||||||
|
|
||||||
// Aggregate pubkeys
|
// Aggregate pubkeys
|
||||||
|
@ -67,6 +68,7 @@ const aggCount = 30;
|
||||||
testRunner: (pks) => {
|
testRunner: (pks) => {
|
||||||
bls.PublicKey.aggregate(pks);
|
bls.PublicKey.aggregate(pks);
|
||||||
},
|
},
|
||||||
|
runs,
|
||||||
});
|
});
|
||||||
|
|
||||||
// Aggregate sigs
|
// Aggregate sigs
|
||||||
|
@ -87,6 +89,7 @@ const aggCount = 30;
|
||||||
testRunner: (sigs) => {
|
testRunner: (sigs) => {
|
||||||
bls.Signature.aggregate(sigs);
|
bls.Signature.aggregate(sigs);
|
||||||
},
|
},
|
||||||
|
runs,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
})();
|
})();
|
||||||
|
|
|
@ -2,9 +2,7 @@ import {runBenchmark} from "./runner";
|
||||||
import {range, randomMessage} from "../test/util";
|
import {range, randomMessage} from "../test/util";
|
||||||
import {generateRandomSecretKey} from "@chainsafe/bls-keygen";
|
import {generateRandomSecretKey} from "@chainsafe/bls-keygen";
|
||||||
import * as noble from "noble-bls12-381";
|
import * as noble from "noble-bls12-381";
|
||||||
|
import {aggCount, runsNoble} from "./params";
|
||||||
const aggCount = 30;
|
|
||||||
const nobleRuns = 10;
|
|
||||||
|
|
||||||
(async function () {
|
(async function () {
|
||||||
// verify
|
// verify
|
||||||
|
@ -26,13 +24,13 @@ const nobleRuns = 10;
|
||||||
testRunner: async ({pk, msg, sig}) => {
|
testRunner: async ({pk, msg, sig}) => {
|
||||||
return await noble.verify(sig, msg, pk);
|
return await noble.verify(sig, msg, pk);
|
||||||
},
|
},
|
||||||
runs: nobleRuns,
|
runs: runsNoble,
|
||||||
});
|
});
|
||||||
|
|
||||||
// Fast aggregate
|
// Fast aggregate
|
||||||
|
|
||||||
await runBenchmark<{pks: Uint8Array[]; msg: Uint8Array; sig: Uint8Array}, boolean>({
|
await runBenchmark<{pks: Uint8Array[]; msg: Uint8Array; sig: Uint8Array}, boolean>({
|
||||||
id: `noble verifyAggregate`,
|
id: `noble verifyAggregate (${aggCount})`,
|
||||||
|
|
||||||
prepareTest: async () => {
|
prepareTest: async () => {
|
||||||
const msg = randomMessage();
|
const msg = randomMessage();
|
||||||
|
@ -57,7 +55,7 @@ const nobleRuns = 10;
|
||||||
const pk = noble.aggregatePublicKeys(pks);
|
const pk = noble.aggregatePublicKeys(pks);
|
||||||
return await noble.verify(sig, msg, pk);
|
return await noble.verify(sig, msg, pk);
|
||||||
},
|
},
|
||||||
runs: nobleRuns,
|
runs: runsNoble,
|
||||||
});
|
});
|
||||||
|
|
||||||
// Aggregate pubkeys
|
// Aggregate pubkeys
|
||||||
|
@ -73,6 +71,6 @@ const nobleRuns = 10;
|
||||||
testRunner: async (pks) => {
|
testRunner: async (pks) => {
|
||||||
noble.aggregatePublicKeys(pks);
|
noble.aggregatePublicKeys(pks);
|
||||||
},
|
},
|
||||||
runs: nobleRuns,
|
runs: runsNoble,
|
||||||
});
|
});
|
||||||
})();
|
})();
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
export const aggCount = 30;
|
||||||
|
export const runs = 100;
|
||||||
|
export const runsNoble = 10;
|
Reference in New Issue