Remove some premature optimizations.

This commit is contained in:
JoelKatz
2013-02-28 13:50:46 -08:00
parent ca5f3833dd
commit 063479d77c
2 changed files with 4 additions and 6 deletions

View File

@@ -141,13 +141,11 @@ void SHAMap::dirtyUp(std::stack<SHAMapTreeNode::pointer>& stack, const uint256&
} }
} }
static const SHAMapTreeNode::pointer no_node; SHAMapTreeNode::pointer SHAMap::checkCacheNode(const SHAMapNode& iNode)
SHAMapTreeNode::ref SHAMap::checkCacheNode(const SHAMapNode& iNode)
{ {
boost::unordered_map<SHAMapNode, SHAMapTreeNode::pointer>::iterator it = mTNByID.find(iNode); boost::unordered_map<SHAMapNode, SHAMapTreeNode::pointer>::iterator it = mTNByID.find(iNode);
if (it == mTNByID.end()) if (it == mTNByID.end())
return no_node; return SHAMapTreeNode::pointer();
it->second->touch(mSeq); it->second->touch(mSeq);
return it->second; return it->second;
} }
@@ -175,7 +173,7 @@ SHAMapTreeNode::pointer SHAMap::walkTo(const uint256& id, bool modify)
} }
} }
if (inNode->getTag() != id) if (inNode->getTag() != id)
return no_node; return SHAMapTreeNode::pointer();
if (modify) if (modify)
returnNode(inNode, true); returnNode(inNode, true);
return inNode; return inNode;

View File

@@ -355,7 +355,7 @@ protected:
std::stack<SHAMapTreeNode::pointer> getStack(const uint256& id, bool include_nonmatching_leaf, bool partialOk); std::stack<SHAMapTreeNode::pointer> getStack(const uint256& id, bool include_nonmatching_leaf, bool partialOk);
SHAMapTreeNode::pointer walkTo(const uint256& id, bool modify); SHAMapTreeNode::pointer walkTo(const uint256& id, bool modify);
SHAMapTreeNode* walkToPointer(const uint256& id); SHAMapTreeNode* walkToPointer(const uint256& id);
SHAMapTreeNode::ref checkCacheNode(const SHAMapNode&); SHAMapTreeNode::pointer checkCacheNode(const SHAMapNode&);
void returnNode(SHAMapTreeNode::pointer&, bool modify); void returnNode(SHAMapTreeNode::pointer&, bool modify);
void trackNewNode(SHAMapTreeNode::pointer&); void trackNewNode(SHAMapTreeNode::pointer&);