Unverified Commit e4728a21 authored by ramdoys's avatar ramdoys Committed by GitHub
Browse files

atomFlags switched to unordered_map for performance (#5247)

* optimization, switch to unordered map

* Remove emplace, reduce reserve allocation
parent 5d8d5874
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
#include <algorithm> #include <algorithm>
#include <set> #include <set>
#include <map> #include <map>
#include <unordered_map>
#include <cmath> #include <cmath>
using namespace std; using namespace std;
...@@ -649,7 +650,8 @@ void CpuNeighborList::threadComputeNeighborList(ThreadPool& threads, int threadI ...@@ -649,7 +650,8 @@ void CpuNeighborList::threadComputeNeighborList(ThreadPool& threads, int threadI
// Record the exclusions for this block. // Record the exclusions for this block.
map<int, BlockExclusionMask> atomFlags; unordered_map<int, BlockExclusionMask> atomFlags;
atomFlags.reserve(atomsInBlock*2);
for (int j = 0; j < atomsInBlock; j++) { for (int j = 0; j < atomsInBlock; j++) {
const set<int>& atomExclusions = (*exclusions)[sortedAtoms[firstIndex+j]]; const set<int>& atomExclusions = (*exclusions)[sortedAtoms[firstIndex+j]];
const BlockExclusionMask mask = 1<<j; const BlockExclusionMask mask = 1<<j;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment