3 ms·
> a vector would likely be more efficient due to better memory locality Vector’s memory locality only matters when you’re iterating over the elements. For this
by Const-me 9y ago
> a vector would likely be more efficient due to better memory locality
Vector’s memory locality only matters when you’re iterating over the elements. For this case it’s essentially a random index.
Besides, unordered_map memory locality is fixable: https://github.com/Const-me/CollectionMicrobench https://github.com/Const-me/CollectionMicrobench
- matt42 9y agoI'll try and swith to unordered_map if it has a negligible impact on performances.