Open
Bug 1976385
Opened 1 year ago
Updated 1 year ago
Demo at https://forsaken-ideas.nicolas-lebrun.fr/sketch/2025-04-30/ is slower in Firefox
Categories
(Core :: JavaScript Engine, task, P3)
Core
JavaScript Engine
Tracking
()
NEW
People
(Reporter: mayankleoboy1, Unassigned)
References
(Blocks 1 open bug, )
Details
Comment 1•1 year ago
|
||
This looks like Array iteration under the R function:
R=(i,e,t)=>i.reduce((n,r)=>[...n,...r.reduce((a,o,l)=>{const h=_(l/(e+t)),c=l%(e+t);return a[h]||(a[h]=[]),c<=e&&a[h].push(o),a},[])],[])
More readable:
function R(i, e, t) {
function inner(a, o, l) {
const h = _(l / (e + t));
const c = l % (e + t);
if (!a[h]) {
a[h] = [];
}
if (c <= e) {
a[h].push(o);
}
return a;
};
function outer(n, r) {
return [...n, ...r.reduce(inner, [])];
}
return i.reduce(outer, []);
}
Adding a fast-path to avoid iteration for array spread in array initialisation should help when executing [...n, ...r.reduce(inner, [])].
Updated•1 year ago
|
Severity: -- → S3
Priority: -- → P3
You need to log in
before you can comment on or make changes to this bug.
Description
•