Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
reduce vs filter+map
Tests performance between a single reduce and a filter then map
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 YaBrowser/25.8.0.0 Safari/537.36
Browser:
Yandex Browser 25
Operating system:
Linux
Device Platform:
Desktop
Date tested:
5 months ago
Test name
Executions per second
reduce
38391.4 Ops/sec
filter+map
25968.1 Ops/sec
Script Preparation code:
var items = []; for (var i = 0; i < 10000; i++) { items[i] = { id: i, selected: i % 4 == 0 }; }
Tests:
reduce
items.reduce( ( array, item ) => { if ( item.selected ) { array.push( item.id ); } return array; }, [] );
filter+map
items.filter( x => x.selected ).map( x => x.id );