You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@mesos.apache.org by "Benjamin Bannier (Jira)" <ji...@apache.org> on 2019/10/01 13:23:00 UTC
[jira] [Created] (MESOS-10000) Consider removing 'hashmap::get'
Benjamin Bannier created MESOS-10000:
----------------------------------------
Summary: Consider removing 'hashmap::get'
Key: MESOS-10000
URL: https://issues.apache.org/jira/browse/MESOS-10000
Project: Mesos
Issue Type: Bug
Components: stout
Reporter: Benjamin Bannier
{{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.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)