Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
finIndex in map vs. lookup + map
(version: 0)
Comparing performance of:
map + findIndex vs lookup + map
Created:
2 years ago
by:
Guest
Jump to the latest result
Script Preparation code:
var arr1 = []; var arr2 = []; var i = 0; var j = 0; while (i <= 1E5) { arr1[i] = i++; arr2[j] = j++; }
Tests:
map + findIndex
arr1.map((item1) => (arr2.findIndex(item2 => item2 === item1)));
lookup + map
const lookup = arr2.reduce((lookup, item, index) => (lookup[item] = index), {}); arr2.map((item) => lookup[item]);
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
map + findIndex
lookup + map
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!
Comments
Confirm delete:
Do you really want to delete benchmark?