Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
lodash some vs loop (static functions)
(version: 8)
Comparing performance of:
use lodash vs use for loop
Created:
9 years ago
by:
Registered User
Jump to the latest result
HTML Preparation code:
<script src="https://cdn.jsdelivr.net/lodash/4.16.2/lodash.min.js"></script>
Script Preparation code:
var sample = [1000, 1234, 1222, 3444, 1, 89, 100, 1200, 88888, 99999, 2000000]; for (var i = 1000000; i > 0; i--){ if(i % 3 === 0){ sample.push[i] } } function check(item) { return item === 55555; } function containsLodash(myList) { return _.some(myList, function myPredicateFn(listItem){ return listItem === Math.floor(Math.random() * 99999); }); } function containsSimple(myList, myItem) { for (var i = 0; i < myList.length; i++) { var contains = myItem === myList[i]; if (contains) { return contains; } } return false; }
Tests:
use lodash
containsLodash(sample)
use for loop
containsSimple(sample, Math.floor(Math.random() * 99999))
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
use lodash
use for loop
Fastest:
N/A
Slowest:
N/A
Latest run results:
No previous run results
This benchmark does not have any results yet. Be the first one
to run it!
Related benchmarks:
Array Intersection vs. Set Intersection vs. Lodash part 3
array tests
Array Intersection vs. Set Intersection vs. Lodash - big
dropWhile comparison
Array Intersection vs. Set Intersection vs. Lodash part 3 mix
Comments
Confirm delete:
Do you really want to delete benchmark?