Move removeIndex's result instead of copying
Currently removeIndex copies the removed value into removed and then destructs the original, which can cause significant performance overhead.
This commit is contained in:
parent
69098a18b9
commit
4e73664f9e
@ -1205,7 +1205,7 @@ bool Value::removeIndex(ArrayIndex index, Value* removed) {
|
||||
return false;
|
||||
}
|
||||
if (removed)
|
||||
*removed = it->second;
|
||||
*removed = std::move(it->second);
|
||||
ArrayIndex oldSize = size();
|
||||
// shift left all items left, into the place of the "removed"
|
||||
for (ArrayIndex i = index; i < (oldSize - 1); ++i) {
|
||||
|
Loading…
Reference in New Issue
Block a user