Improve dictionary access from AbstractTable
mrks opened this issue · 2 comments
mrks commented
I believe that this (in AbstractTable::setValue) can be improved, as the current implementation requires two tree traversals whenever a value is inserted:
if (map->valueExists(value)) {
valueId.valueId = map->getValueIdForValue(value);
} else {
valueId.valueId = map->addValue(value);
}
}
If we added a map::insert-like interface to the BaseDictionary, we could do this in one step:
The single element versions (1) return a pair, with its member pair::first set to an iterator pointing to either the newly inserted element or to the element with an equivalent key in the map.
bastih commented
👍
grundprinzip commented
+1