Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
native find vs lodash _.find BIG
(version: 0)
native array find vs lodash find
Comparing performance of:
array find vs _.find
Created:
3 years ago
by:
Guest
Jump to the latest result
HTML Preparation code:
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.11/lodash.core.js"></script>
Script Preparation code:
var users = [{ 'user': 'joey', 'age': 32 }, { 'user': 'ross', 'age': 41 }, { 'user': 'chandler', 'age': 39 }, { 'user': 'a', 'age': 39 }, { 'user': 'b', 'age': 49 }, { 'user': 'a', 'age': 39 }, { 'user': 'b', 'age': 49 }, { 'user': 'a', 'age': 39 }, { 'user': 'b', 'age': 49 }, { 'user': 'a', 'age': 39 }, { 'user': 'b', 'age': 49 }, { 'user': 'a', 'age': 39 }, { 'user': 'b', 'age': 49 }, { 'user': 'a', 'age': 39 }, { 'user': 'b', 'age': 49 }, { 'user': 'a', 'age': 39 }, { 'user': 'b', 'age': 49 }, { 'user': 'a', 'age': 39 }, { 'user': 'b', 'age': 49 }, { 'user': 'a', 'age': 39 }, { 'user': 'b', 'age': 49 }, { 'user': 'a', 'age': 39 }, { 'user': 'b', 'age': 49 }, { 'user': 'a', 'age': 39 }, { 'user': 'b', 'age': 49 }, { 'user': 'a', 'age': 39 }, { 'user': 'b', 'age': 49 }, { 'user': 'a', 'age': 39 }, { 'user': 'b', 'age': 49 }, { 'user': 'a', 'age': 39 }, { 'user': 'b', 'age': 49 }, { 'user': 'a', 'age': 39 }, { 'user': 'b', 'age': 49 }, { 'user': 'a', 'age': 39 }, { 'user': 'b', 'age': 49 }, { 'user': 'a', 'age': 39 }, { 'user': 'b', 'age': 49 }, { 'user': 'a', 'age': 39 }, { 'user': 'b', 'age': 49 }, { 'user': 'a', 'age': 39 }, { 'user': 'b', 'age': 49 }, { 'user': 'a', 'age': 39 }, { 'user': 'b', 'age': 49 }, { 'user': 'a', 'age': 39 }, { 'user': 'b', 'age': 49 }, { 'user': 'a', 'age': 39 }, { 'user': 'b', 'age': 49 }, ]
Tests:
array find
// Native users.find(function (o) { return o.age < 40; })
_.find
_.find(users, function (o) { return o.age < 40; })
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
array find
_.find
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!
Autogenerated LLM Summary
(model
llama3.2:3b
, generated one year ago):
Let's break down the provided benchmark definition and explain what's being tested. **Benchmark Definition** The benchmark is comparing two approaches to find an element in an array: 1. **Native Array Find**: This uses the built-in `find()` method of JavaScript arrays. 2. **Lodash _.find**: This uses a function from the Lodash library, specifically the `_find` function. **Options Compared** The options being compared are: * Native Array Find (JavaScript's built-in `find()` method) * Lodash _.find (a function from the Lodash library) **Pros and Cons of Each Approach** 1. **Native Array Find**: * Pros: + Built into JavaScript, no additional dependencies needed. + Fast and efficient, as it uses a linear search algorithm. * Cons: + May not be as readable or maintainable as other approaches. 2. **Lodash _.find**: * Pros: + More readable and maintainable than native array find. + Provides additional functionality beyond simple element searching (e.g., support for more complex search predicates). * Cons: + Requires an additional dependency on the Lodash library, which may increase load time or require version management. **Individual Test Cases** The benchmark has two individual test cases: 1. **array find**: This uses the native `find()` method of JavaScript arrays. 2. **_.find**: This uses the `_find` function from the Lodash library. **Latest Benchmark Result** The latest benchmark result shows the performance differences between the two approaches: | Browser | ExecutionsPerSecond | | --- | --- | | Firefox 101 (Native Array Find) | 679,765,360.0 | | Firefox 101 (Lodash _.find) | 132,002,460.0 | In this case, the native `find()` method is significantly faster than the Lodash `_find` function. I hope that helps!
Related benchmarks:
lodash find vs native find
native reverse find vs lodash _.findLast larger sample
native find vs lodash _.find with null values and object
native find vs lodash _.find for objects equality
Comments
Confirm delete:
Do you really want to delete benchmark?