Merge branch 'master' into patch-3

This commit is contained in:
Paul Miller 2020-12-03 20:23:21 +04:00 committed by GitHub
commit 94caa9bedd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 27 additions and 24 deletions

View File

@ -87,9 +87,9 @@ The API is identical for all implementations.
## Benchmarks
- `blst`: [src/blst](src/blst)
- `herumi`: [src/herumi](src/herumi)
- `noble`: [noble-bls12-381](https://github.com/paulmillr/noble-bls12-381)
- `blst`: [src/blst](src/blst) (node.js-only, bindings to C via node-gyp)
- `herumi`: [src/herumi](src/herumi) (node.js & browser, wasm)
- `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`).

View File

@ -1,6 +1,6 @@
import {runBenchmark} from "./runner";
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 {aggCount, runs} from "./params";
@ -120,5 +120,22 @@ import {aggCount, runs} from "./params";
},
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,
});
});
})();

View File

@ -105,20 +105,6 @@ import {aggCount, runsNoble} from "./params";
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>({
id: `noble sign`,