Some performance tweaks.

This commit is contained in:
JoelKatz
2012-10-28 21:05:07 -07:00
parent aa8211e60b
commit 0db9fc865c
3 changed files with 9 additions and 2 deletions

View File

@@ -41,6 +41,7 @@ void SHAMap::getMissingNodes(std::vector<SHAMapNode>& nodeIDs, std::vector<uint2
stack.pop();
int base = rand() % 256;
bool have_all = false;
for (int ii = 0; ii < 16; ++ii)
{ // traverse in semi-random order
int branch = (base + ii) % 16;
@@ -76,7 +77,8 @@ void SHAMap::getMissingNodes(std::vector<SHAMapNode>& nodeIDs, std::vector<uint2
}
if (!d)
{ // we need this node
nodeIDs.push_back(node->getChildNodeID(branch));
have_all = false;
nodeIDs.push_back(childID);
if (--max <= 0)
return;
}
@@ -84,6 +86,8 @@ void SHAMap::getMissingNodes(std::vector<SHAMapNode>& nodeIDs, std::vector<uint2
stack.push(d);
}
}
if (have_all)
node->setFullBelow();
}
}