arnaucube
arnaucube/circomPublic Self-hosted repository
Optimize recursive constant dependency
Jordi Baylina jordi@baylina.cat
Thu, 17 Sep 2020 17:42:32 +0200
commit

5dc54bb7d24e30aef91fb973b65294386953610d

parent

349a39dc95a5d4da071b7bf74e94db5dcb77a756

1 files changed, 10 insertions(+), 3 deletions(-)

jump to
M src/compiler.js → src/compiler.js

@@ -346,16 +346,23 @@ nextPossibleConstraints = new BigArray();

} else { nextPossibleConstraints = {}; } - removedSignals = new BigArray(); + removedSignals = {}; nRemoved = 0; - lIdx = new BigArray(); + lIdx = {}; for (let i=0;i<possibleConstraints.length;i++) { if ((ctx.verbose)&&(i%10000 == 0)) { await Promise.resolve(); console.log(`reducing constraints: ${i}/${possibleConstraints.length} reduced: ${nRemoved}`); } + const c = ctx.constraints[possibleConstraints[i]]; if (!c) continue; + + // Limit of number of lelements removed per step + if (nRemoved>100000) { + nextPossibleConstraints[possibleConstraints[i]] = true; + continue; + } // Swap a and b if b has more variables. if (Object.keys(c.b).length > Object.keys(c.a).length) {

@@ -434,7 +441,7 @@ }

} } - const removedSignalsList = removedSignals.getKeys(); + const removedSignalsList = Object.keys(removedSignals); for (let i=0; i<removedSignalsList.length; i++) { if ((ctx.verbose )&&(i%100000 == 0)) console.log(`removing signals: ${i}/${removedSignalsList.length}`);