Skip to content
Snippets Groups Projects
Commit a5d29c90 authored by Adrien Béraud's avatar Adrien Béraud
Browse files

op cache: optimize cache insertion

parent 989f32eb
No related branches found
No related tags found
No related merge requests found
...@@ -25,7 +25,7 @@ bool ...@@ -25,7 +25,7 @@ bool
OpValueCache::onValuesAdded(const std::vector<Sp<Value>>& vals) { OpValueCache::onValuesAdded(const std::vector<Sp<Value>>& vals) {
std::vector<Sp<Value>> newValues; std::vector<Sp<Value>> newValues;
for (const auto& v : vals) { for (const auto& v : vals) {
auto viop = values.emplace(v->id, OpCacheValueStorage{v}); auto viop = values.emplace(v->id, v);
if (viop.second) { if (viop.second) {
newValues.emplace_back(v); newValues.emplace_back(v);
} else { } else {
......
...@@ -27,7 +27,7 @@ struct OpCacheValueStorage ...@@ -27,7 +27,7 @@ struct OpCacheValueStorage
{ {
Sp<Value> data {}; Sp<Value> data {};
unsigned refCount {1}; unsigned refCount {1};
OpCacheValueStorage(Sp<Value> val = {}) : data(val) {} OpCacheValueStorage(Sp<Value> val) : data(val) {}
}; };
class OpValueCache { class OpValueCache {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment