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 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36
Browser:
Chrome 142
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
7 months ago
Test name
Executions per second
Functional
138989.7 Ops/sec
Imperative
853688.3 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