Open Bug 1978199 Opened 8 days ago Updated 5 days ago

Modified demo at https://codepen.io/mootytootyfrooty/pen/bNdoWXy is 2x slower in Firefox.

Categories

(Core :: JavaScript Engine, task, P3)

task

Tracking

()

People

(Reporter: mayankleoboy1, Unassigned)

References

(Blocks 1 open bug, )

Details

Attachments

(1 file)

Attached file index.html

Open testcase (original at https://codepen.io/mootytootyfrooty/pen/bNdoWXy)
Enter 500 in rows and columns fields
Click on "Generate' button

Chrome: https://share.firefox.dev/46Ox8Um (7.5s)
Firefox: https://share.firefox.dev/44EbtwU (15s)
Edit: updated the FF link.

The FF link is broken, it should be: https://share.firefox.dev/44EbtwU (15s)

We're spending 93% of time in the carveHunt JS function. This might perform a little better from a non-file:// URL due to Spectre mitigations being enabled for file:// still. My current fuses work might also help a bit.

    function carveHunt(){
      for(let y=0;y<H;y++) for(let x=0;x<W;x++){
        if(grid[y][x]!==0) continue;
        const nb=[];
        if(y>0   && grid[y-1][x]!==0) nb.push(NORTH);
        if(x>0   && grid[y][x-1]!==0) nb.push(WEST);
        if(x<W-1 && grid[y][x+1]!==0) nb.push(EAST);
        if(y<H-1 && grid[y+1][x]!==0) nb.push(SOUTH);
        if(!nb.length) continue;
        const d=nb[Math.floor(rnd()*nb.length)],
              nx=x+DX[d], ny=y+DY[d];
        grid[y][x]|=d; grid[ny][nx]|=OPP[d];
        return [x,y];
      }
      return null;
    }
Severity: -- → N/A
Priority: -- → P3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: