Skip to content

Commit

Permalink
perf: return cached curve before
Browse files Browse the repository at this point in the history
  • Loading branch information
cedoor committed Oct 18, 2023
1 parent 2980e48 commit 459ef23
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/bls12381.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { ModuleBuilder } from "wasmbuilder";
globalThis.curve_bls12381 = null;

export default async function buildBls12381(singleThread, plugins) {
if ((!singleThread) && (globalThis.curve_bls12381)) return globalThis.curve_bls12381;

const moduleBuilder = new ModuleBuilder();
moduleBuilder.setMemory(25);
Expand Down Expand Up @@ -33,7 +34,6 @@ export default async function buildBls12381(singleThread, plugins) {
bls12381wasm.r = moduleBuilder.modules.bls12381.r;


if ((!singleThread) && (globalThis.curve_bls12381)) return globalThis.curve_bls12381;
const params = {
name: "bls12381",
wasm: bls12381wasm,
Expand Down
2 changes: 1 addition & 1 deletion src/bn128.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { ModuleBuilder } from "wasmbuilder";
globalThis.curve_bn128 = null;

export default async function buildBn128(singleThread, plugins) {
if ((!singleThread) && (globalThis.curve_bn128)) return globalThis.curve_bn128;

const moduleBuilder = new ModuleBuilder();
moduleBuilder.setMemory(25);
Expand All @@ -32,7 +33,6 @@ export default async function buildBn128(singleThread, plugins) {
bn128wasm.q = moduleBuilder.modules.bn128.q;
bn128wasm.r = moduleBuilder.modules.bn128.r;

if ((!singleThread) && (globalThis.curve_bn128)) return globalThis.curve_bn128;
const params = {
name: "bn128",
wasm: bn128wasm,
Expand Down

0 comments on commit 459ef23

Please sign in to comment.