Browse Source

Optimize optimize constraints not BigArray for small circuits

master
Jordi Baylina 4 years ago
parent
commit
bad8fad3d0
No known key found for this signature in database GPG Key ID: 7480C80C1BE43112
1 changed files with 13 additions and 3 deletions
  1. +13
    -3
      src/compiler.js

+ 13
- 3
src/compiler.js

@ -341,7 +341,11 @@ async function reduceConstrains(ctx) {
} }
while (possibleConstraints.length >0) { while (possibleConstraints.length >0) {
nextPossibleConstraints = new BigArray();
if (possibleConstraints.length>1<<20) {
nextPossibleConstraints = new BigArray();
} else {
nextPossibleConstraints = {};
}
removedSignals = new BigArray(); removedSignals = new BigArray();
nRemoved = 0; nRemoved = 0;
lIdx = new BigArray(); lIdx = new BigArray();
@ -404,7 +408,11 @@ async function reduceConstrains(ctx) {
} }
} }
nextPossibleConstraints = nextPossibleConstraints.getKeys();
if (nextPossibleConstraints.getKeys) {
nextPossibleConstraints = nextPossibleConstraints.getKeys();
} else {
nextPossibleConstraints = Object.keys(nextPossibleConstraints);
}
for (let i=0; i<nextPossibleConstraints.length;i++) { for (let i=0; i<nextPossibleConstraints.length;i++) {
if ((ctx.verbose)&&(i%10000 == 0)) { if ((ctx.verbose)&&(i%10000 == 0)) {
@ -440,12 +448,14 @@ async function reduceConstrains(ctx) {
lSignal.c = ctx.stDISCARDED; lSignal.c = ctx.stDISCARDED;
} }
/*
possibleConstraints = new BigArray(); possibleConstraints = new BigArray();
// Reverse // Reverse
for (let i=0; i<nextPossibleConstraints.length; i++) { for (let i=0; i<nextPossibleConstraints.length; i++) {
possibleConstraints[i] = nextPossibleConstraints[nextPossibleConstraints.length -1 -i]; possibleConstraints[i] = nextPossibleConstraints[nextPossibleConstraints.length -1 -i];
} }
*/
possibleConstraints = nextPossibleConstraints;
} }

Loading…
Cancel
Save