Sidewall belt and screen drawing, cheaper cleat checks (t42, t43)
Far sidewall drawn behind the load with cleat ribs at their physics positions; sloped screens get a tinted mesh between rails and shake only when loaded. Powder skips cleat checks outside chunks that have cleats, and empty slopes let their chunks sleep. Record the screw conveyor and stall/carry-depth decisions. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -20,15 +20,32 @@ assert(samples.length===5 && samples.every(n=>Number.isFinite(n) && n>0));
|
||||
samples.sort((a,b)=>a-b);
|
||||
console.log(`576 loaded slope blocks, median ${samples[2].toFixed(3)} ms/tick; samples ${samples.map(v=>v.toFixed(3)).join(', ')}`);
|
||||
|
||||
// No slopes: isolate the extra guards in the shared powder hot loop.
|
||||
// No slopes: use the zero flag supplied once per chunk by simMove. Older powder ignores it.
|
||||
flatWorld(run,512,384,376);
|
||||
run('RS=7;for(let y=32;y<350;y+=2)for(let x=32;x<480;x++){mat[y*W+x]=SAND;mat[(y+1)*W+x]=STONE;}');
|
||||
const powderSamples=[];
|
||||
for(let sample=0;sample<6;sample++) {
|
||||
const start=performance.now();
|
||||
run('for(let k=0;k<30;k++)for(let y=32;y<350;y+=2)for(let x=32;x<480;x++)powder(y*W+x,x,y,SAND);');
|
||||
run('for(let k=0;k<30;k++)for(let y=32;y<350;y+=2)for(let x=32;x<480;x++)powder(y*W+x,x,y,SAND,0);');
|
||||
if(sample)powderSamples.push(performance.now()-start);
|
||||
}
|
||||
assert(powderSamples.length===5 && powderSamples.every(n=>Number.isFinite(n) && n>0));
|
||||
powderSamples.sort((a,b)=>a-b);
|
||||
console.log(`2.14M powder calls without cleats, median ${powderSamples[2].toFixed(2)} ms`);
|
||||
|
||||
// Generated terrain plus a replenished falling sand curtain, with zero or 50 slope blocks.
|
||||
for (const slopes of [0, 50]) {
|
||||
const times = [];
|
||||
for (let sample = 0; sample < 6; sample++) {
|
||||
run(`generateWorld(12345, 1024, 640); weather.next=1e15; money=1e9;
|
||||
for(let y=16;y<160;y++)for(let x=80;x<480;x++)setCell(y*W+x,EMPTY,AMB[y],0);
|
||||
for(let k=0;k<${slopes};k++) {const bx=25+(k%10),by=32+Math.floor(k/10)*5-(k%10);
|
||||
placeBlock(BP_BELT_UP,1,bx,by,true);}
|
||||
for(let t=0;t<60;t++){for(let x=80;x<480;x++)if(mat[16*W+x]===EMPTY)setCell(16*W+x,SAND,AMB[16],0);simTick();}`);
|
||||
const start = performance.now();
|
||||
run(`for(let t=0;t<180;t++){for(let x=80;x<480;x++)if(mat[16*W+x]===EMPTY)setCell(16*W+x,SAND,AMB[16],0);simTick();}`);
|
||||
if (sample) times.push((performance.now()-start)/180);
|
||||
}
|
||||
assert(times.every(n=>Number.isFinite(n) && n>0)); times.sort((a,b)=>a-b);
|
||||
console.log(`generated falling world, ${slopes} slopes: ${times[2].toFixed(3)} ms/tick; ${times.map(n=>n.toFixed(3)).join(', ')}`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user