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

Issue 2838163002: Use base::flat_set<> rather than std::set<> for ResourceType set (Closed)

Created:
3 years, 8 months ago by Adam Rice
Modified:
3 years, 7 months ago
Reviewers:
Nathan Parker
CC:
chromium-reviews, vakh+watch_chromium.org, timvolodine
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

Use base::flat_set<> rather than std::set<> for ResourceType set components::RemoteDatabaseManager keeps a set of ResourceTypes which it is applied to. The members of the set are integers and there can be at most 18 members, so it is more efficient to use a base::flat_set here. BUG= Review-Url: https://codereview.chromium.org/2838163002 Cr-Commit-Position: refs/heads/master@{#468563} Committed: https://chromium.googlesource.com/chromium/src/+/b08fe054f49f402b9e513ecc8283152f80eefb09

Patch Set 1 #

Total comments: 2

Patch Set 2 : Simpler initialisation for the flat_set with O(N^2) complexity #

Patch Set 3 : Reserve the vector size upfront to reduce allocations #

Unified diffs Side-by-side diffs Delta from patch set Stats (+6 lines, -1 line) Patch
M components/safe_browsing_db/remote_database_manager.h View 2 chunks +2 lines, -1 line 0 comments Download
M components/safe_browsing_db/remote_database_manager.cc View 1 2 1 chunk +4 lines, -0 lines 0 comments Download

Messages

Total messages: 24 (16 generated)
Adam Rice
Just a drive-by. Should shave off a few bytes and cycles, but feel free to ...
3 years, 8 months ago (2017-04-25 14:49:34 UTC) #6
Nathan Parker
https://codereview.chromium.org/2838163002/diff/1/components/safe_browsing_db/remote_database_manager.cc File components/safe_browsing_db/remote_database_manager.cc (right): https://codereview.chromium.org/2838163002/diff/1/components/safe_browsing_db/remote_database_manager.cc#newcode104 components/safe_browsing_db/remote_database_manager.cc:104: std::vector<content::ResourceType> types_to_check; This seems seems like overkill for 18 ...
3 years, 8 months ago (2017-04-25 15:23:14 UTC) #7
Nathan Parker
What's the difference between set and flat_set? How does it scale? FYI there are lots ...
3 years, 8 months ago (2017-04-25 15:25:04 UTC) #8
Adam Rice
https://codereview.chromium.org/2838163002/diff/1/components/safe_browsing_db/remote_database_manager.cc File components/safe_browsing_db/remote_database_manager.cc (right): https://codereview.chromium.org/2838163002/diff/1/components/safe_browsing_db/remote_database_manager.cc#newcode104 components/safe_browsing_db/remote_database_manager.cc:104: std::vector<content::ResourceType> types_to_check; On 2017/04/25 15:23:14, Nathan Parker wrote: > ...
3 years, 8 months ago (2017-04-26 05:18:27 UTC) #9
Adam Rice
On 2017/04/25 15:25:04, Nathan Parker wrote: > What's the difference between set and flat_set? How ...
3 years, 8 months ago (2017-04-26 05:30:13 UTC) #10
Nathan Parker
lgtm
3 years, 7 months ago (2017-05-01 22:09:48 UTC) #19
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/2838163002/40001
3 years, 7 months ago (2017-05-02 04:24:10 UTC) #21
commit-bot: I haz the power
3 years, 7 months ago (2017-05-02 05:12:38 UTC) #24
Message was sent while issue was closed.
Committed patchset #3 (id:40001) as
https://chromium.googlesource.com/chromium/src/+/b08fe054f49f402b9e513ecc8283...

Powered by Google App Engine
This is Rietveld 408576698