Run details:
Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.54 Safari/537.36
Chrome 95
Windows 8.1
Desktop
3 years ago
Test name Executions per second
map-filter 20913.2 Ops/sec
reduce 31302.7 Ops/sec
Script Preparation code:
x
 
a=[];
for(i=0;i<1000;i++) a.push(Number(i)/1000);
var filtering=x=>(x*114514)%1>0.5;
var mapping=x=>x+0.1919;
var reducing=(acc,x)=>{
  if((x*114514)%1>0.5) acc.push(x+0.1919);
  return acc;
}
Tests:
  • map-filter

     
    a.filter(filtering).map(mapping);
  • reduce

     
    a.reduce(reducing,[]);