Description
hashmap<K, V>::get returns an Option<V> and is a convenient shortcut to avoid a contains check followed by e.g., hashmap::operator[]. Since it always creates a copy it can, however, be unnecessarily costly if the caller is not interested in storing the returned value, but e.g., only interested in invoking a member accessing a member in which case the contains check and operator[] are always preferrable for performance reasons.
We should consider removing hashmap::get since it can easily lead to expensive code.
Attachments
Issue Links
- is related to
-
MESOS-9948 master::Slave::hasExecutor occupies 37% of a 150 second perf sample.
- Resolved