New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 715340 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner: ----
Closed: Nov 15
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

Should we change the generated type of mojom map from std::unordered_map to something else?

Project Member Reported by yzshen@chromium.org, Apr 25 2017

Issue description

Brett just published a guide which suggests to avoid std::unordered_map (or at least think carefully before using it). (Please see //base/containers/README.md.)

"""But it has high memory overhead for small sizes which most of our maps are. It's also slightly slower than std::map to insert into, has poor cache coherency (every insert is a malloc), and isn't as much faster at querying over the alternatives than you might expect (it can even be slower!)."""

I wonder whether we should do some evaluation and consider changing the generated type of mojom map from std::unordered_map to something else.

The biggest reason to choose std::unordered_map was because it is more consistent with the blink-side type, which is WTF::HashMap.
 

Comment 1 by tibell@chromium.org, Apr 26 2017

I was somewhat surprised by this advice since the memory overhead per-element is usually higher for map than unordered_map, but I guess if the map is small enough we allocate a too big backing array for unordered_map.

Cc: -roc...@chromium.org rockot@google.com
Status: Fixed (was: Untriaged)
It's been changed to base::flat_map.

Sign in to add a comment