Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Lodash omit vs Native delete
(version: 0)
Comparing performance of:
Lodash omit vs Native delete
Created:
6 years ago
by:
Guest
Jump to the latest result
HTML Preparation code:
<script src="//cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.5/lodash.min.js"></script>
Script Preparation code:
data = {abf:'asd',message:'koko'}
Tests:
Lodash omit
const meta = _.omit(data, 'message')
Native delete
const meta = Object.assign({}, data); delete meta.message;
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
Lodash omit
Native delete
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
one month ago
)
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/145.0.0.0 Safari/537.36
Browser/OS:
Chrome 145 on Mac OS X 10.15.7
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
Lodash omit
3693628.2 Ops/sec
Native delete
11723243.0 Ops/sec
Autogenerated LLM Summary
(model
llama3.2:3b
, generated one year ago):
I'd be happy to explain what's being tested in the provided JSON benchmark. **What is being tested?** The benchmark is testing two approaches for removing properties from an object: using Lodash's `omit` function and using native JavaScript's `delete` operator. **Options compared:** There are two options being compared: 1. **Lodash's `omit` function**: This function takes an object and a key as arguments, and returns a new object with the specified key removed. 2. **Native JavaScript's `delete` operator**: This operator is used to delete a property from an object. **Pros and Cons of each approach:** * **Lodash's `omit` function:** + Pros: - Easy to use and understand, especially for developers familiar with Lodash. - Can be more convenient than using native JavaScript methods for simple cases. + Cons: - May have a performance overhead due to the creation of a new object. - May not be as efficient as native JavaScript methods for large objects or complex operations. * **Native JavaScript's `delete` operator:** + Pros: - More efficient than using Lodash's `omit` function, especially for large objects or complex operations. - Does not create a new object, which can save memory. + Cons: - Can be less convenient to use, especially for developers unfamiliar with native JavaScript methods. **Library used:** Lodash is a popular JavaScript library that provides various utility functions. In this case, Lodash's `omit` function is being tested. **Special JS feature or syntax:** None mentioned in the provided JSON benchmark. **Benchmark preparation code and HTML:** The script preparation code sets up an object `data` with two properties: `abf` and `message`. The HTML preparation code includes a link to include Lodash's JavaScript file, which makes it available for use in the tests. **Other alternatives:** If you wanted to test other approaches, you could consider: 1. Using a different library or utility function (e.g., jQuery's `.delete()` method). 2. Implementing your own `omit` function using native JavaScript methods. 3. Testing multiple browsers or environments to see how the performance of each approach varies. Keep in mind that these alternatives would require additional code changes and modifications to the benchmark setup. The latest benchmark results show that the Native delete operator performs better than Lodash's `omit` function, with a significantly higher number of executions per second on Firefox 120.
Related benchmarks:
Lodash omit vs Native delete vs Native destruct - Mantz
Lodash omit vs Native delete - Mav
Omit Vs Native Delete - Objects Pre-Initialized
Native delete vs Lodash omit - multiple properties
Comments
Confirm delete:
Do you really want to delete benchmark?