1
0
Fork 0

speed up object iteration

This commit is contained in:
jsteemann 2017-01-19 12:44:09 +01:00
parent 1fdda42af9
commit 1e24b00a82
2 changed files with 6 additions and 6 deletions

View File

@ -246,18 +246,18 @@ class ObjectIterator {
return ObjectPair(_slice.getNthKey(_position, true), _slice.getNthValue(_position)); return ObjectPair(_slice.getNthKey(_position, true), _slice.getNthValue(_position));
} }
ObjectIterator begin() { return ObjectIterator(_slice, _allowRandomIteration); } ObjectIterator begin() { return ObjectIterator(*this); }
ObjectIterator begin() const { return ObjectIterator(_slice, _allowRandomIteration); } ObjectIterator begin() const { return ObjectIterator(*this); }
ObjectIterator end() { ObjectIterator end() {
auto it = ObjectIterator(_slice, _allowRandomIteration); auto it = ObjectIterator(*this);
it._position = it._size; it._position = it._size;
return it; return it;
} }
ObjectIterator end() const { ObjectIterator end() const {
auto it = ObjectIterator(_slice, _allowRandomIteration); auto it = ObjectIterator(*this);
it._position = it._size; it._position = it._size;
return it; return it;
} }

View File

@ -3595,7 +3595,7 @@ void LogicalCollection::mergeObjectsForUpdate(
{ {
VPackObjectIterator it(newValue, true); VPackObjectIterator it(newValue, true);
while (it.valid()) { while (it.valid()) {
StringRef key(it.key()); std::string key = it.key().copyString();
if (!key.empty() && key[0] == '_' && if (!key.empty() && key[0] == '_' &&
(key == StaticStrings::KeyString || key == StaticStrings::IdString || (key == StaticStrings::KeyString || key == StaticStrings::IdString ||
key == StaticStrings::RevString || key == StaticStrings::RevString ||
@ -3609,7 +3609,7 @@ void LogicalCollection::mergeObjectsForUpdate(
} // else do nothing } // else do nothing
} else { } else {
// regular attribute // regular attribute
newValues.emplace(std::string(key.data(), key.size()), it.value()); newValues.emplace(std::move(key), it.value());
} }
it.next(); it.next();