From f29898d9dc39b624622072e08b8b6027f6ed8b81 Mon Sep 17 00:00:00 2001 From: dapplion Date: Sat, 14 Nov 2020 22:25:22 +0000 Subject: [PATCH] benchmark as jacobian --- test/benchmark/index.ts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/test/benchmark/index.ts b/test/benchmark/index.ts index 5aa1b65..c790a9f 100644 --- a/test/benchmark/index.ts +++ b/test/benchmark/index.ts @@ -1,5 +1,6 @@ import crypto from "crypto"; import * as blst from "@chainsafe/blst-ts"; +import {blst as blstBindings} from "@chainsafe/blst-ts/dist/bindings"; import * as herumi from "../../src"; import {runBenchmark} from "./runner"; @@ -116,6 +117,25 @@ import {runBenchmark} from "./runner"; }, }); + runBenchmark({ + id: `BLST aggregatePubkeys as jacobian (${aggCount})`, + + prepareTest: () => { + return { + input: range(aggCount).map(() => { + const pk = blst.SecretKey.fromKeygen(crypto.randomBytes(32)).toPublicKey(); + return blst.AggregatePublicKey.fromPublicKey(pk); + }), + }; + }, + testRunner: (pks) => { + const p1Arr = pks.map((pk) => pk.value); + p1Arr.reduce((agg, pk) => { + return blstBindings.P1.add(agg, pk); + }); + }, + }); + runBenchmark({ id: `HERUMI aggregatePubkeys (${aggCount})`,