Speed test: switch off the routing shortcuts in their new spelling (flows are columns now)
This commit is contained in:
parent
88c37d1b48
commit
b6c2fe677b
1 changed files with 4 additions and 4 deletions
|
|
@ -272,17 +272,17 @@ test('the map is not drawn while the dashboard covers the whole screen', () => {
|
|||
function plainCompute(ev) {
|
||||
const src = ev('compute.toString()');
|
||||
let plain = src
|
||||
.replace('if(!lst.hi&&ALONE[f.ci])', 'if(false)')
|
||||
.replace('if(!lst.hi&&ALONE[fci])', 'if(false)')
|
||||
.replace('if(!G.length){\n // One scan', 'if(false){\n // One scan')
|
||||
.replace('for(const n of e.nets||NET_IDS)', 'for(const n of NET_IDS)')
|
||||
.replace('const ns=e.nets||NET_IDS;', 'const ns=NET_IDS;')
|
||||
.replace('if(P.dead)return 0;', '').replaceAll('if(r<=1e-6){P.dead=1;return 0;}', '')
|
||||
.replace('if(!P.dead)room-=push(', 'room-=push(').replace(/const gone=e=>\{[^\n]*\};/, 'const gone=e=>false;');
|
||||
// ...and the group split and sorting written the plain way, with array copies, as before they were made allocation-free
|
||||
const sg = plain.indexOf('const ROOM=[],sendGroup='), sd = plain.indexOf('const sortD=');
|
||||
assert.ok(sg > 0 && sd > sg, 'found the group sender and the sort');
|
||||
plain = plain.slice(0, sg) + `const ROOM=[],sendGroup=(g0,i0=0,i1=g0.length)=>{const g=g0.slice(i0,i1);for(const e of g)e.vis=vis;
|
||||
if(g.length>1){const room=g.map(e=>Math.max(0,e.cap-e.used)),tot=room.reduce((a,b)=>a+b,0),want=f.rem;if(tot>1e-6)g.forEach((e,k)=>send(e,want*room[k]/tot));}
|
||||
for(const e of g){if(f.rem<=1e-6)break;send(e,f.rem);}};\n ` + plain.slice(sd).replace(/^const sortD=a=>\{[^\n]*\};/, 'const sortD=a=>a.sort(byDist);');
|
||||
if(g.length>1){const room=g.map(e=>Math.max(0,e.cap-e.used)),tot=room.reduce((a,b)=>a+b,0),want=FREM[F];if(tot>1e-6)g.forEach((e,k)=>send(e,want*room[k]/tot));}
|
||||
for(const e of g){if(FREM[F]<=1e-6)break;send(e,FREM[F]);}};\n ` + plain.slice(sd).replace(/^const sortD=a=>\{[^\n]*\};/, 'const sortD=a=>a.sort(byDist);');
|
||||
for (const [a, b] of [[src, plain]]) assert.notEqual(a, b);
|
||||
assert.equal((plain.match(/if\(false\)/g) || []).length, 2, 'both shortcuts were found and switched off');
|
||||
assert.ok(!plain.includes('e.nets||NET_IDS'), 'the exit index was switched off');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue