Open
Bug 1986183
Opened 1 year ago
Updated 1 year ago
Modified Codepen demo at https://codepen.io/Valgo/pen/jOrqjOM?editors=0010 is slower in Firefox, spending time in filter
Categories
(Core :: JavaScript Engine, task, P3)
Core
JavaScript Engine
Tracking
()
NEW
People
(Reporter: mayankleoboy1, Unassigned)
References
(Blocks 1 open bug, )
Details
Attachments
(1 file)
|
5.26 KB,
text/html
|
Details |
Open attached html (unmodified demo at https://codepen.io/Valgo/pen/jOrqjOM?editors=0010)
firefox: https://share.firefox.dev/3HOLvy4 (34s) / https://share.firefox.dev/3JDsmQd (74s)
Chrome: https://share.firefox.dev/46gyh6w (17s)
There is some variability in the demo, so timings will change in each run.
| Reporter | ||
Comment 1•1 year ago
|
||
Updated•1 year ago
|
Severity: -- → N/A
Priority: -- → P3
Comment 2•1 year ago
|
||
The profile shows that V8 is spending a higher fraction of its time sorting. I'm pretty sure their sorting is at least as fast as ours, so what this actually means is that we're significantly slower elsewhere, in particular in the calls to filter in collapseOne:
const collapseOne = grid => {
const lowestEntropy = grid.filter(cell => !cell.collapsed).sort((a, b) => a.entropy - b.entropy)[0].entropy;
const cells = grid.filter(cell => cell.entropy <= lowestEntropy && !cell.collapsed);
const cell = cells[Math.floor(Math.random() * cells.length)];
cell.collapsed = true;
const collapsedState = pickState(cell);
cell.states = [collapsedState];
propogate(cell);
return grid.filter(cell => cell.states.length === 0).length === 0;
};
(Note that this code isn't written particularly efficiently.)
You need to log in
before you can comment on or make changes to this bug.
Description
•