Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
asdasdasdhgdth5454455454
(version: 0)
asasdasdasdasda
Comparing performance of:
Lo vs Fi/ma vs Obj.val
Created:
6 years ago
by:
Guest
Jump to the latest result
HTML Preparation code:
<script src="https://cdn.jsdelivr.net/npm/lodash@4.17.4/lodash.min.js"></script>
Script Preparation code:
var AssetCategory = { NONE: 'NONE', VESSEL: 'VESSEL', NONE2: 'NONE2', VESSEL2: 'VESSEL2' }
Tests:
Lo
_(AssetCategory).omit([AssetCategory.NONE]).values().value()
Fi/ma
Object.keys(AssetCategory) .filter(x => x !== AssetCategory.NONE) .map(key => ({ label: key, value: key }));
Obj.val
Object.values(_.omit(AssetCategory, [AssetCategory.NONE]))
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (3)
Previous results
Fork
Test case name
Result
Lo
Fi/ma
Obj.val
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 benchmark and analyze what is being tested. **Benchmark Overview** The benchmark compares three different approaches for retrieving specific values from an object: 1. Using `Object.keys()`, `filter()`, `map()` (Approach 1: Fi/ma) 2. Using Lodash's `omit()` function with `values()` method (Approach 2: Obj.val) 3. Using Lodash's `omit()` function directly on the object and then accessing values using `Object.values()` (Approach 3: Lo) **Options Compared** * Approach 1 (Fi/ma): Uses built-in JavaScript methods (`Object.keys()`, `filter()`, `map()`) to achieve the desired result. + Pros: - Easy to understand and implement for developers familiar with these methods. - No additional dependencies required. + Cons: - May be slower due to the overhead of calling built-in methods. - Can lead to less readable code if not properly formatted. * Approach 2 (Obj.val): Uses Lodash's `omit()` function and then accessing values using `Object.values()`. + Pros: - Provides a convenient way to remove unwanted properties from an object. - Can be faster due to the optimized implementation of `omit()` in Lodash. + Cons: - Requires including an additional library (Lodash) which may not be desirable for all projects. * Approach 3 (Lo): Uses Lodash's `omit()` function directly on the object and then accessing values using `Object.values()`. + Pros: - Similar to Approach 2, but avoids creating a new object with filtered properties. - Still leverages optimized implementation of `omit()` in Lodash. + Cons: - Requires including an additional library (Lodash) which may not be desirable for all projects. **Library and Special JS Features** The benchmark uses Lodash, a popular JavaScript utility library that provides various functions for working with data structures. The specific functions used here are: * `omit()`: Removes specified properties from an object. * `values()`: Returns the values of an object (in this case, applied to the result of `omit()`). The benchmark does not use any special JS features or syntax that would be unfamiliar to most developers. **Other Alternatives** If you were to reimplement these approaches without using Lodash, you could consider: * Using a library like `array-filter-map` for Approach 1. * Writing a custom implementation of `omit()` and then accessing values using `Object.values()`, similar to Approach 3. However, these alternatives would likely be less efficient and less convenient than using established libraries like Lodash.
Related benchmarks:
CircleSmallTest
asdasdasdasd
Object keys as array - remove first
Test Performance lodash
Comments
Confirm delete:
Do you really want to delete benchmark?