Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Functional Vs Imperative
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/143.0.0.0 Mobile Safari/537.36
Browser:
Chrome Mobile 143
Operating system:
Android
Device Platform:
Mobile
Date tested:
5 months ago
Test name
Executions per second
Functional
31940.6 Ops/sec
Imperative
293421.4 Ops/sec
Script Preparation code:
window.nums = new Array(1000).fill(0).map((x,i) => i)
Tests:
Functional
const y = nums.filter(x => x%2).map(x => x*3).filter(x => x < 100) return y
Imperative
const y = [] for(const x of nums) { if(x%2) { const x3 = x*3; if(x3 < 100) { y.push(x3) } } } return y