Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(174)

Issue 2847553002: cc: Replace some instances of unordered_map with base::flat_map. (Closed)

Created:
3 years, 8 months ago by vmpstr
Modified:
3 years, 7 months ago
Reviewers:
danakj
CC:
chromium-reviews, cc-bugs_chromium.org
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

cc: Replace some instances of unordered_map with base::flat_map. This patch replaces some instances of unordered_map with flat_map. This is done for cases where we can reason out that the number of elements contained is small. R=danakj@chromium.org CQ_INCLUDE_TRYBOTS=master.tryserver.blink:linux_trusty_blink_rel Review-Url: https://codereview.chromium.org/2847553002 Cr-Commit-Position: refs/heads/master@{#467722} Committed: https://chromium.googlesource.com/chromium/src/+/c6237d1546aab8f12ac514775b1ae67dd0de56aa

Patch Set 1 #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+9 lines, -8 lines) Patch
M cc/output/direct_renderer.h View 1 chunk +0 lines, -1 line 0 comments Download
M cc/output/direct_renderer.cc View 1 chunk +0 lines, -1 line 0 comments Download
M cc/output/gl_renderer.h View 1 chunk +1 line, -0 lines 2 comments Download
M cc/paint/discardable_image_map.h View 2 chunks +2 lines, -2 lines 0 comments Download
M cc/paint/discardable_image_map.cc View 3 chunks +3 lines, -2 lines 0 comments Download
M cc/quads/render_pass.h View 1 chunk +0 lines, -1 line 0 comments Download
M cc/surfaces/surface_aggregator.h View 1 chunk +1 line, -0 lines 0 comments Download
M cc/tiles/image_controller.h View 2 chunks +2 lines, -1 line 0 comments Download

Messages

Total messages: 15 (6 generated)
vmpstr
Please take a look. https://codereview.chromium.org/2847553002/diff/1/cc/output/gl_renderer.h File cc/output/gl_renderer.h (right): https://codereview.chromium.org/2847553002/diff/1/cc/output/gl_renderer.h#newcode303 cc/output/gl_renderer.h:303: std::unordered_map<ProgramKey, std::unique_ptr<Program>, ProgramKeyHash> The ProgramKey ...
3 years, 8 months ago (2017-04-26 22:12:00 UTC) #2
danakj
LGTM https://codereview.chromium.org/2847553002/diff/1/cc/output/gl_renderer.h File cc/output/gl_renderer.h (right): https://codereview.chromium.org/2847553002/diff/1/cc/output/gl_renderer.h#newcode303 cc/output/gl_renderer.h:303: std::unordered_map<ProgramKey, std::unique_ptr<Program>, ProgramKeyHash> 2017/04/26 22:12:00, vmpstr wrote: > ...
3 years, 8 months ago (2017-04-26 22:16:32 UTC) #3
vmpstr
On 2017/04/26 22:16:32, danakj wrote: > LGTM > > https://codereview.chromium.org/2847553002/diff/1/cc/output/gl_renderer.h > File cc/output/gl_renderer.h (right): > ...
3 years, 8 months ago (2017-04-26 22:54:54 UTC) #4
commit-bot: I haz the power
CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2847553002/1
3 years, 8 months ago (2017-04-26 22:56:07 UTC) #6
vmpstr
On 2017/04/26 22:54:54, vmpstr wrote: > On 2017/04/26 22:16:32, danakj wrote: > > LGTM > ...
3 years, 8 months ago (2017-04-26 22:56:37 UTC) #7
commit-bot: I haz the power
Try jobs failed on following builders: linux_chromium_rel_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_rel_ng/builds/440005)
3 years, 8 months ago (2017-04-27 00:38:11 UTC) #9
commit-bot: I haz the power
CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2847553002/1
3 years, 7 months ago (2017-04-27 16:32:42 UTC) #11
commit-bot: I haz the power
Committed patchset #1 (id:1) as https://chromium.googlesource.com/chromium/src/+/c6237d1546aab8f12ac514775b1ae67dd0de56aa
3 years, 7 months ago (2017-04-27 17:45:22 UTC) #14
danakj
3 years, 7 months ago (2017-04-27 20:03:36 UTC) #15
Message was sent while issue was closed.
On Wed, Apr 26, 2017 at 6:56 PM, <vmpstr@chromium.org> wrote:

> On 2017/04/26 22:54:54, vmpstr wrote:
> > On 2017/04/26 22:16:32, danakj wrote:
> > > LGTM
> > >
> > > https://codereview.chromium.org/2847553002/diff/1/cc/
> output/gl_renderer.h
> > > File cc/output/gl_renderer.h (right):
> > >
> > >
> >
> https://codereview.chromium.org/2847553002/diff/1/cc/output/gl_renderer.h#
> newcode303
> > > cc/output/gl_renderer.h:303: std::unordered_map<ProgramKey,
> > > std::unique_ptr<Program>, ProgramKeyHash>
> > > 2017/04/26 22:12:00, vmpstr wrote:
> > > > The ProgramKey here is pretty big. It does have an equality
> operator, but
> > > > writing an operator< for it is a bit awkward (especially since one
> of the
> > > > comparison operators compares a pointer).
> > > >
> > > > Is the guidance in these cases to bite the bullet and just write
> operator<?
> > >
> > > As long as it's consistent and transitive and such, I don't think that
> > comparing
> > > pointers is a problem.
> >
> > Pointer comparison for < is a bit hairy from the standards perspective,
> in
> that
> > I think the result of this comparison are "unspecified", but that doesn't
> > preclude it from being consistent... It's harder to argue that it doesn't
> > preclude it from being transitive, but it's probably fine...
> >
> > I'm defer changing this for later.
> >
> > >
> > > However I don't think we really understood the performance of flat_map
> with
> > > large keys. As long as you're considering that size when you look at
> the
> size
> > of
> > > the map, and not just the number of elements then it should be okay I
> think
> > > though. You might wanna perftest to be sure for this one tho, it does
> seem
> > like
> > > new territory.
> >
> > We could generate the hash for it as part of the item itself (kind of
> like we
> do
> > with image keys) and then use < on that first, so that it would early
> out if
> the
> > hashes don't match.
>
> oh we can just use this:
> "For templates greater, less, greater_equal, and less_equal, the
> specializations for any pointer type yield a total order, even if the
> built-in
> operators <, >, <=, >= do not."
>

Oh interesting. I have a feeling all software ever would break if pointers
were not integers and thus not transitive for comparisons but who knows.


>
> https://codereview.chromium.org/2847553002/
>

-- 
You received this message because you are subscribed to the Google Groups
"Chromium-reviews" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to chromium-reviews+unsubscribe@chromium.org.

Powered by Google App Engine
This is Rietveld 408576698