8000 Feature/mmfiles hash lookup performance (#3265) · arangodb/arangodb@2525a3a · GitHub
[go: up one dir, main page]

Skip to content

Commit 2525a3a

Browse files
jsteemannfceller
authored andcommitted
Feature/mmfiles hash lookup performance (#3265)
* speed up full collection scans in mmfiles engine * some API cleanup
1 parent 3afebae commit 2525a3a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+1096
-1369
lines changed

arangod/Aql/Aggregator.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ void AggregatorMin::reduce(AqlValue const& cmpValue) {
130130

131131
AqlValue AggregatorMin::stealValue() {
132132
if (value.isEmpty()) {
133-
return AqlValue(arangodb::basics::VelocyPackHelper::NullValue());
133+
return AqlValue(AqlValueHintNull());
134134
}
135135
AqlValue copy = value;
136136
value.erase();
@@ -151,7 +151,7 @@ void AggregatorMax::reduce(AqlValue const& cmpValue) {
151151

152152
AqlValue AggregatorMax::stealValue() {
153153
if (value.isEmpty()) {
154-
return AqlValue(arangodb::basics::VelocyPackHelper::NullValue());
154+
return AqlValue(AqlValueHintNull());
155155
}
156156
AqlValue copy = value;
157157
value.erase();
@@ -184,7 +184,7 @@ void AggregatorSum::reduce(AqlValue const& cmpValue) {
184184

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

190190
builder.clear();
@@ -223,7 +223,7 @@ void AggregatorAverage::reduce(AqlValue const& cmpValue) {
223223
AqlValue AggregatorAverage::stealValue() {
224224
if (invalid || count == 0 || std::isnan(sum) || sum == HUGE_VAL ||
225225
sum == -HUGE_VAL) {
226-
return AqlValue(arangodb::basics::VelocyPackHelper::NullValue());
226+
return AqlValue(AqlValueHintNull());
227227
}
228228

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

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

295295
TRI_ASSERT(count > 0);

arangod/Aql/AqlItemBlock.cpp

Lines changed: 4 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -207,10 +207,8 @@ void AqlItemBlock::destroy() {
207207
}
208208

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

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

227-
if (sweep) {
228-
// erase all stored values in the region that we freed
229-
for (size_t i = nrItems; i < _nrItems; ++i) {
230-
for (RegisterId j = 0; j < _nrRegs; ++j) {
231-
AqlValue& a(_data[_nrRegs * i + j]);
232-
233-
if (a.requiresDestruction()) {
234-
auto it = _valueCount.find(a);
235-
236-
if (it != _valueCount.end()) {
237-
TRI_ASSERT((*it).second > 0);
238-
239-
if (--((*it).second) == 0) {
240-
decreaseMemoryUsage(a.memoryUsage());
241-
a.destroy();
242-
try {
243-
_valueCount.erase(it);
244-
} catch (...) {
245-
}
246-
}
247-
}
248-
}
249-
a.erase();
250-
}
251-
}
252-
}
253-
254225
decreaseMemoryUsage(sizeof(AqlValue) * (_nrItems - nrItems) * _nrRegs);
255226

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

298-
for (auto const& reg : toClear) {
299-
for (size_t i = 0; i < _nrItems; i++) {
269+
for (size_t i = 0; i < _nrItems; i++) {
270+
for (auto const& reg : toClear) {
300271
AqlValue& a(_data[_nrRegs * i + reg]);
301272

302273
if (a.requiresDestruction()) {

arangod/Aql/AqlItemBlock.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -296,10 +296,8 @@ class AqlItemBlock {
296296
inline size_t capacity() const { return _data.size(); }
297297

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

304302
/// @brief rescales the block to the specified dimensions
305303
/// note that the block should be empty before rescaling to prevent

0 commit comments

Comments
 (0)
0