mirror of https://gitee.com/bigwinds/arangodb
micro optimizations
This commit is contained in:
parent
4bc0ce7355
commit
f431afd23b
|
@ -211,7 +211,7 @@ AqlItemBlock* EnumerateCollectionBlock::getSome(size_t, // atLeast,
|
|||
// The result is in the first variable of this depth,
|
||||
// we do not need to do a lookup in getPlanNode()->_registerPlan->varInfo,
|
||||
// but can just take cur->getNrRegs() as registerId:
|
||||
res->setValue(j, static_cast<arangodb::aql::RegisterId>(curRegs), AqlValue(_iterator.value().begin()));
|
||||
res->setValue(j, static_cast<arangodb::aql::RegisterId>(curRegs), AqlValue(_iterator.value()));
|
||||
// No harm done, if the setValue throws!
|
||||
}
|
||||
|
||||
|
|
|
@ -514,8 +514,7 @@ void ExecutionNode::invalidateCost() {
|
|||
dep->invalidateCost();
|
||||
|
||||
// no need to virtualize this function too, as getType(), estimateCost()
|
||||
// etc.
|
||||
// are already virtual
|
||||
// etc. are already virtual
|
||||
if (dep->getType() == SUBQUERY) {
|
||||
// invalid cost of subqueries, too
|
||||
static_cast<SubqueryNode*>(dep)->getSubquery()->invalidateCost();
|
||||
|
|
|
@ -1623,9 +1623,10 @@ struct VarUsageFinder final : public WalkerWorker<ExecutionNode> {
|
|||
|
||||
/// @brief determine and set _varsUsedLater in all nodes
|
||||
void ExecutionPlan::findVarUsage() {
|
||||
::VarUsageFinder finder;
|
||||
_varSetBy.clear();
|
||||
::VarUsageFinder finder(&_varSetBy);
|
||||
root()->walk(&finder);
|
||||
_varSetBy = *finder._varSetBy;
|
||||
// _varSetBy = *finder._varSetBy;
|
||||
|
||||
_varUsageComputed = true;
|
||||
}
|
||||
|
|
|
@ -67,7 +67,6 @@ bool Optimizer::addPlan(ExecutionPlan* plan, Rule const* rule, bool wasModified,
|
|||
|
||||
plan->clearVarUsageComputed();
|
||||
plan->invalidateCost();
|
||||
|
||||
plan->findVarUsage();
|
||||
}
|
||||
|
||||
|
|
|
@ -188,12 +188,12 @@ void arangodb::aql::sortInValuesRule(Optimizer* opt, ExecutionPlan* plan,
|
|||
|
||||
// make the new node a parent of the original calculation node
|
||||
calculationNode->addDependency(setter);
|
||||
auto const& oldParents = setter->getParents();
|
||||
TRI_ASSERT(!oldParents.empty());
|
||||
calculationNode->addParent(oldParents[0]);
|
||||
auto oldParent = setter->getFirstParent();
|
||||
TRI_ASSERT(oldParent != nullptr);
|
||||
calculationNode->addParent(oldParent);
|
||||
|
||||
oldParents[0]->removeDependencies();
|
||||
oldParents[0]->addDependency(calculationNode);
|
||||
oldParent->removeDependencies();
|
||||
oldParent->addDependency(calculationNode);
|
||||
setter->setParent(calculationNode);
|
||||
|
||||
if (setter->getType() == EN::CALCULATION) {
|
||||
|
@ -1011,8 +1011,8 @@ void arangodb::aql::specializeCollectRule(Optimizer* opt, ExecutionPlan* plan,
|
|||
newPlan->registerNode(sortNode);
|
||||
|
||||
TRI_ASSERT(newCollectNode->hasParent());
|
||||
auto const& parents = newCollectNode->getParents();
|
||||
auto parent = parents[0];
|
||||
auto parent = newCollectNode->getFirstParent();
|
||||
TRI_ASSERT(parent != nullptr);
|
||||
|
||||
sortNode->addDependency(newCollectNode);
|
||||
parent->replaceDependency(newCollectNode, sortNode);
|
||||
|
@ -2148,10 +2148,9 @@ void arangodb::aql::interchangeAdjacentEnumerationsRule(
|
|||
// newNodes[lowBound..highBound-1] in newPlan and replace
|
||||
// them by the same ones in a different order, given by
|
||||
// permTuple[lowBound..highBound-1].
|
||||
auto const& parents = newNodes[lowBound]->getParents();
|
||||
auto parent = newNodes[lowBound]->getFirstParent();
|
||||
|
||||
TRI_ASSERT(parents.size() == 1);
|
||||
auto parent = parents[0]; // needed for insertion later
|
||||
TRI_ASSERT(parent != nullptr);
|
||||
|
||||
// Unlink all those nodes:
|
||||
for (size_t j = lowBound; j < highBound; j++) {
|
||||
|
|
Loading…
Reference in New Issue