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

@@ -1037,6 +1037,9 @@ int Ledger::getPendingSaves()
void Ledger::pendSave(bool fromConsensus)
{
if (!fromConsensus && !theApp->isNew(getHash()))
return;
boost::thread thread(boost::bind(&Ledger::saveAcceptedLedger, shared_from_this(), fromConsensus));
thread.detach();

View File

@@ -152,7 +152,7 @@ void LedgerMaster::setFullLedger(Ledger::ref ledger)
if (mMissingLedger || !theConfig.FULL_HISTORY)
return;
if (Ledger::getPendingSaves() > 2)
if (Ledger::getPendingSaves() > 3)
{
cLog(lsINFO) << "Too many pending ledger saves";
return;

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();
}
}