Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Map Solution
(version: 0)
Code with map solution
Comparing performance of:
Map Solution vs findIndex solution
Created:
4 years ago
by:
Guest
Jump to the latest result
Script Preparation code:
objectives = [ { "index": 1, "name": "obj1", "unit": "unit1", "type": "Maximize", "target": null, "bounds": [0, 100], "weight": 1, "minimize": false }, { "index": 2, "name": "obj2", "unit": "unit2", "type": "Minimize", "target": null, "bounds": [0, 100], "weight": 1, "minimize": true }, { "index": 3, "name": "obj3", "unit": "unit3", "type": "Approximate", "target": 50, "bounds": [0, 100], "weight": 1, "minimize": false } ], editedObjective = { "index": 3, "name": "obj3", "unit": "unit3", "type": "Approximate", "target": 50, "bounds": [0, 100], "weight": 1, "minimize": false }
Tests:
Map Solution
objectives = objectives.map((objective) => ( objective.index !== editedObjective.index ? objective : editedObjective ));
findIndex solution
const objectivePosition = objectives.findIndex( (objective) => objective.index === editedObjective.index, ); // eslint-disable-next-line no-param-reassign objectives[objectivePosition] = editedObjective;
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
Map Solution
findIndex solution
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:
map vs fromentries
ывавыа
Test Array manipulations
Object vs map 100
test array vs map lookup 3
Comments
Confirm delete:
Do you really want to delete benchmark?