Merge branch 'master' into patch-3
This commit is contained in:
commit
94caa9bedd
|
@ -87,9 +87,9 @@ The API is identical for all implementations.
|
||||||
|
|
||||||
## Benchmarks
|
## Benchmarks
|
||||||
|
|
||||||
- `blst`: [src/blst](src/blst)
|
- `blst`: [src/blst](src/blst) (node.js-only, bindings to C via node-gyp)
|
||||||
- `herumi`: [src/herumi](src/herumi)
|
- `herumi`: [src/herumi](src/herumi) (node.js & browser, wasm)
|
||||||
- `noble`: [noble-bls12-381](https://github.com/paulmillr/noble-bls12-381)
|
- `noble`: [noble-bls12-381](https://github.com/paulmillr/noble-bls12-381) (node.js & browser, pure JS)
|
||||||
|
|
||||||
Results are in `ops/sec (x times slower)`, where `x times slower` = times slower than fastest implementation (`blst`).
|
Results are in `ops/sec (x times slower)`, where `x times slower` = times slower than fastest implementation (`blst`).
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import {runBenchmark} from "./runner";
|
import {runBenchmark} from "./runner";
|
||||||
import {runForAllImplementations} from "../test/switch";
|
import {runForAllImplementations} from "../test/switch";
|
||||||
import {PublicKey, Signature} from "../src/interface";
|
import {PublicKey, Signature, SecretKey} from "../src/interface";
|
||||||
import {range, randomMessage} from "../test/util";
|
import {range, randomMessage} from "../test/util";
|
||||||
import {aggCount, runs} from "./params";
|
import {aggCount, runs} from "./params";
|
||||||
|
|
||||||
|
@ -120,5 +120,22 @@ import {aggCount, runs} from "./params";
|
||||||
},
|
},
|
||||||
runs,
|
runs,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Sign
|
||||||
|
|
||||||
|
await runBenchmark<{sk: SecretKey; msg: Uint8Array}, void>({
|
||||||
|
id: `${implementation} sign`,
|
||||||
|
|
||||||
|
prepareTest: () => ({
|
||||||
|
input: {
|
||||||
|
sk: bls.SecretKey.fromKeygen(),
|
||||||
|
msg: randomMessage(),
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
testRunner: ({sk, msg}) => {
|
||||||
|
sk.sign(msg);
|
||||||
|
},
|
||||||
|
runs,
|
||||||
|
});
|
||||||
});
|
});
|
||||||
})();
|
})();
|
||||||
|
|
|
@ -105,20 +105,6 @@ import {aggCount, runsNoble} from "./params";
|
||||||
runs: runsNoble,
|
runs: runsNoble,
|
||||||
});
|
});
|
||||||
|
|
||||||
await runBenchmark<Uint8Array[], void>({
|
|
||||||
id: `noble aggregate sigs (${aggCount})`,
|
|
||||||
|
|
||||||
prepareTest: async () => {
|
|
||||||
return {
|
|
||||||
input: await Promise.all(range(aggCount).map(() => noble.PointG2.hashToCurve(generateRandomSecretKey()))),
|
|
||||||
};
|
|
||||||
},
|
|
||||||
testRunner: async (sigs) => {
|
|
||||||
noble.aggregateSignatures(sigs);
|
|
||||||
},
|
|
||||||
runs: runsNoble,
|
|
||||||
});
|
|
||||||
|
|
||||||
await runBenchmark<{sk: Uint8Array; msg: Uint8Array}, void>({
|
await runBenchmark<{sk: Uint8Array; msg: Uint8Array}, void>({
|
||||||
id: `noble sign`,
|
id: `noble sign`,
|
||||||
|
|
||||||
|
|
Reference in New Issue