Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
filter(Boolean) vs. filter(a => a)
Removing empties
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/133.0.0.0 Safari/537.36
Browser:
Chrome 133
Operating system:
Linux
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
filter(Boolean)
1669.0 Ops/sec
filter(a => a)
2567.4 Ops/sec
filter(a => !!a)
1442.3 Ops/sec
Script Preparation code:
window.list = []; for (let i = 0; i < 65536; i++) { window.list.push(Math.random() > 0.5 ? 1 : 0); }
Tests:
filter(Boolean)
list.filter(Boolean);
filter(a => a)
list.filter(a => a);
filter(a => !!a)
list.filter(a => !!a)