8000 Feature/mmfiles hash lookup performance by jsteemann · Pull Request #3265 · arangodb/arangodb · GitHub
[go: up one dir, main page]

Skip to content

Feature/mmfiles hash lookup performance #3265

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Si 10000 gn in to your account

Merged
merged 16 commits into from
Sep 26, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions arangod/Aql/Aggregator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ void AggregatorMin::reduce(AqlValue const& cmpValue) {

AqlValue AggregatorMin::stealValue() {
if (value.isEmpty()) {
return AqlValue(arangodb::basics::VelocyPackHelper::NullValue());
return AqlValue(AqlValueHintNull());
}
AqlValue copy = value;
value.erase();
Expand All @@ -151,7 +151,7 @@ void AggregatorMax::reduce(AqlValue const& cmpValue) {

AqlValue AggregatorMax::stealValue() {
if (value.isEmpty()) {
return AqlValue(arangodb::basics::VelocyPackHelper::NullValue());
return AqlValue(AqlValueHintNull());
}
AqlValue copy = value;
value.erase();
Expand Down Expand Up @@ -184,7 +184,7 @@ void AggregatorSum::reduce(AqlValue const& cmpValue) {

AqlValue AggregatorSum::stealValue() {
if (invalid || std::isnan(sum) || sum == HUGE_VAL || sum == -HUGE_VAL) {
return AqlValue(arangodb::basics::VelocyPackHelper::NullValue());
return AqlValue(AqlValueHintNull());
}

builder.clear();
Expand Down Expand Up @@ -223,7 +223,7 @@ void AggregatorAverage::reduce(AqlValue const& cmpValue) {
AqlValue AggregatorAverage::stealValue() {
if (invalid || count == 0 || std::isnan(sum) || sum == HUGE_VAL ||
sum == -HUGE_VAL) {
return AqlValue(arangodb::basics::VelocyPackHelper::NullValue());
return AqlValue(AqlValueHintNull());
}

TRI_ASSERT(count > 0);
Expand Down Expand Up @@ -267,7 +267,7 @@ void AggregatorVarianceBase::reduce(AqlValue const& cmpValue) {
AqlValue AggregatorVariance::stealValue() {
if (invalid || count == 0 || (count == 1 && !population) || std::isnan(sum) ||
sum == HUGE_VAL || sum == -HUGE_VAL) {
return AqlValue(arangodb::basics::VelocyPackHelper::NullValue());
return AqlValue(AqlValueHintNull());
}

TRI_ASSERT(count > 0);
Expand All @@ -289,7 +289,7 @@ AqlValue AggregatorVariance::stealValue() {
AqlValue AggregatorStddev::stealValue() {
if (invalid || count == 0 || (count == 1 && !population) || std::isnan(sum) ||
sum == HUGE_VAL || sum == -HUGE_VAL) {
return AqlValue(arangodb::basics::VelocyPackHelper::NullValue());
return AqlValue(AqlValueHintNull());
}

TRI_ASSERT(count > 0);
Expand Down
37 changes: 4 additions & 33 deletions arangod/Aql/AqlItemBlock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,10 +207,8 @@ void AqlItemBlock::destroy() {
}

/// @brief shrink the block to the specified number of rows
/// if sweep is set, then the superfluous rows are cleaned
/// if sweep is not set, the caller has to ensure that the
/// superfluous rows are empty
void AqlItemBlock::shrink(size_t nrItems, bool sweep) {
/// the superfluous rows are cleaned
void AqlItemBlock::shrink(size_t nrItems) {
TRI_ASSERT(nrItems > 0);

if (nrItems == _nrItems) {
Expand All @@ -224,33 +222,6 @@ void AqlItemBlock::shrink(size_t nrItems, bool sweep) {
"cannot use shrink() to increase block");
}

if (sweep) {
// erase all stored values in the region that we freed
for (size_t i = nrItems; i < _nrItems; ++i) {
for (RegisterId j = 0; j < _nrRegs; ++j) {
AqlValue& a(_data[_nrRegs * i + j]);

if (a.requiresDestruction()) {
auto it = _valueCount.find(a);

if (it != _valueCount.end()) {
TRI_ASSERT((*it).second > 0);

if (--((*it).second) == 0) {
decreaseMemoryUsage(a.memoryUsage());
a.destroy();
try {
_valueCount.erase(it);
} catch (...) {
}
}
}
}
a.erase();
}
}
}

decreaseMemoryUsage(sizeof(AqlValue) * (_nrItems - nrItems) * _nrRegs);

// adjust the size of the block
Expand Down Expand Up @@ -295,8 +266,8 @@ void AqlItemBlock::rescale(size_t nrItems, RegisterId nrRegs) {
void AqlItemBlock::clearRegisters(
std::unordered_set<RegisterId> const& toClear) {

for (auto const& reg : toClear) {
for (size_t i = 0; i < _nrItems; i++) {
for (size_t i = 0; i < _nrItems; i++) {
for (auto const& reg : toClear) {
AqlValue& a(_data[_nrRegs * i + reg]);

if (a.requiresDestruction()) {
Expand Down
6 changes: 2 additions & 4 deletions arangod/Aql/AqlItemBlock.h
Original file line number Diff line number Diff line change
Expand Up @@ -296,10 +296,8 @@ class AqlItemBlock {
inline size_t capacity() const { return _data.size(); }

/// @brief shrink the block to the specified number of rows
/// if sweep is set, then the superfluous rows are cleaned
/// if sweep is not set, the caller has to ensure that the
/// superfluous rows are empty
void shrink(size_t nrItems, bool sweep);
/// the superfluous rows are cleaned
void shrink(size_t nrItems);

/// @brief rescales the block to the specified dimensions
/// note that the block should be empty before rescaling to prevent
Expand Down
Loading
0