Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
filter vs compact
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/125.0.0.0 Safari/537.36
Browser:
Chrome 125
Operating system:
Linux
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
lodash filter
4719547.5 Ops/sec
lodash compact
8550679.0 Ops/sec
Native filter
10497725.0 Ops/sec
HTML Preparation code:
<script src="https://cdn.jsdelivr.net/lodash/4.16.0/lodash.min.js"></script>
Script Preparation code:
var ops = [null, 1, 2, 3, 4, 5, null, null, null, 3, 4,5, 6, 34,341,2,2,2,1,212,21212,34,1,3112, null];
Tests:
lodash filter
_.filter(ops, op => !!op)
lodash compact
_.compact(ops)
Native filter
ops.filter(op => !!op)