8000 Micro-optimization for ArangoSearch executor by gnusi · Pull Request #14862 · arangodb/arangodb · GitHub
[go: up one dir, main page]

Skip to content

Micro-optimization for ArangoSearch executor #14862

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? Sign in to your account

Merged
merged 4 commits into from
Oct 5, 2021
Merged
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
29 changes: 13 additions & 16 deletions arangod/Aql/IResearchViewExecutor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -273,10 +273,8 @@ IndexIterator::DocumentCallback IResearchViewExecutorBase<Impl, Traits>::ReadCon
typedef std::function<IndexIterator::DocumentCallback(ReadContext&)> CallbackFactory;

static CallbackFactory const callbackFactory{[](ReadContext& ctx) {
return [&ctx](LocalDocumentId /*id*/, VPackSlice doc) {
AqlValue a{AqlValueHintCopy(doc.begin())};
AqlValueGuard guard{a, true};
ctx.outputRow.moveValueInto(ctx.getDocumentReg(), ctx.inputRow, guard);
return [&ctx](LocalDocumentId /*id*/, VPackSlice const doc) {
ctx.outputRow.moveValueInto(ctx.getDocumentReg(), ctx.inputRow, doc);
return true;
};
}};
Expand Down Expand Up @@ -629,15 +627,14 @@ bool IResearchViewExecutorBase<Impl, Traits>::writeLocalDocumentId(
// For sake of performance we store raw pointer to collection
// It is safe as pipeline work inside one process
static_assert(sizeof(void*) <= sizeof(uint64_t),
"Pointer not fits in uint64_t");
AqlValue a(AqlValueHintUInt(reinterpret_cast<uint64_t>(&collection)));
AqlValueGuard guard{a, true};
ctx.outputRow.moveValueInto(ctx.getCollectionPointerReg(), ctx.inputRow, guard);
"Pointer doesn't fit uint64_t");

AqlValueHintUInt const value{reinterpret_cast<uint64_t>(&collection)};
ctx.outputRow.moveValueInto(ctx.getCollectionPointerReg(), ctx.inputRow, value);
}
{
AqlValue a(AqlValueHintUInt(documentId.id()));
AqlValueGuard guard{a, true};
ctx.outputRow.moveValueInto(ctx.getDocumentIdReg(), ctx.inputRow, guard);
AqlValueHintUInt const value{documentId.id()};
ctx.outputRow.moveValueInto(ctx.getDocumentIdReg(), ctx.inputRow, value);
}
return true;
} else {
Expand All @@ -654,7 +651,7 @@ inline bool IResearchViewExecutorBase<Impl, Traits>::writeStoredValue(
auto const& storedValue = storedValues[index];
TRI_ASSERT(!storedValue.empty());
auto const totalSize = storedValue.size();
auto slice = VPackSlice(storedValue.c_str());
VPackSlice slice{storedValue.c_str()};
size_t size = 0;
size_t i = 0;
for (auto const& [fieldNum, registerId] : fieldsRegs) {
Expand All @@ -664,13 +661,13 @@ inline bool IResearchViewExecutorBase<Impl, Traits>::writeStoredValue(
if (ADB_UNLIKELY(size > totalSize)) {
return false;
}
slice = VPackSlice(slice.end());
slice = VPackSlice{slice.end()};
++i;
}
TRI_ASSERT(!slice.isNone());
AqlValue v(slice);
AqlValueGuard guard{v, true};
ctx.outputRow.moveValueInto(registerId, ctx.inputRow, guard);

VPackSlice const& value = slice;
ctx.outputRow.moveValueInto(registerId, ctx.inputRow, value);
}
return true;
}
Expand Down
0