mirror of https://gitee.com/bigwinds/arangodb
attempt to speed up updates a bit
This commit is contained in:
parent
19595ad169
commit
487fa44b04
|
@ -142,6 +142,13 @@ class Buffer {
|
|||
initWithNone();
|
||||
}
|
||||
|
||||
void resetTo(ValueLength position) {
|
||||
if (position >= _alloc) {
|
||||
throw Exception(Exception::IndexOutOfBounds);
|
||||
}
|
||||
_pos = position;
|
||||
}
|
||||
|
||||
void clear() {
|
||||
reset();
|
||||
if (_buffer != _local) {
|
||||
|
|
|
@ -3593,9 +3593,9 @@ void LogicalCollection::mergeObjectsForUpdate(
|
|||
|
||||
std::unordered_map<std::string, VPackSlice> newValues;
|
||||
{
|
||||
VPackObjectIterator it(newValue, false);
|
||||
VPackObjectIterator it(newValue, true);
|
||||
while (it.valid()) {
|
||||
std::string key = it.key().copyString();
|
||||
StringRef key(it.key());
|
||||
if (!key.empty() && key[0] == '_' &&
|
||||
(key == StaticStrings::KeyString || key == StaticStrings::IdString ||
|
||||
key == StaticStrings::RevString ||
|
||||
|
@ -3609,7 +3609,7 @@ void LogicalCollection::mergeObjectsForUpdate(
|
|||
} // else do nothing
|
||||
} else {
|
||||
// regular attribute
|
||||
newValues.emplace(std::move(key), it.value());
|
||||
newValues.emplace(std::string(key.data(), key.size()), it.value());
|
||||
}
|
||||
|
||||
it.next();
|
||||
|
@ -3647,7 +3647,7 @@ void LogicalCollection::mergeObjectsForUpdate(
|
|||
|
||||
// add other attributes after the system attributes
|
||||
{
|
||||
VPackObjectIterator it(oldValue, false);
|
||||
VPackObjectIterator it(oldValue, true);
|
||||
while (it.valid()) {
|
||||
std::string key = it.key().copyString();
|
||||
// exclude system attributes in old value now
|
||||
|
@ -3690,15 +3690,15 @@ void LogicalCollection::mergeObjectsForUpdate(
|
|||
}
|
||||
|
||||
// add remaining values that were only in new object
|
||||
for (auto& it : newValues) {
|
||||
auto& s = it.second;
|
||||
for (auto const& it : newValues) {
|
||||
VPackSlice const& s = it.second;
|
||||
if (s.isNone()) {
|
||||
continue;
|
||||
}
|
||||
if (!keepNull && s.isNull()) {
|
||||
continue;
|
||||
}
|
||||
b.add(std::move(it.first), s);
|
||||
b.add(it.first, s);
|
||||
}
|
||||
|
||||
b.close();
|
||||
|
|
Loading…
Reference in New Issue