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

Issue 1010973013: Refactor Uses of std::set to std::vector in SimpleFeature (Closed)

Created:
5 years, 9 months ago by robliao
Modified:
5 years, 8 months ago
CC:
chromium-reviews, miu+watch_chromium.org, chromium-apps-reviews_chromium.org, markusheintz_, erikwright+watch_chromium.org, extensions-reviews_chromium.org, rkaplow, tfarina
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Refactor Uses of std::set to std::vector in SimpleFeature Local profiling suggests that converting std::set to std::vector will save around 10% of the overall startup time, likely due to the reduced allocs involved with std::vector. This change also reduces lookups by traversing the incoming dictionary and iterating on the available values instead of looking through all values for all features. Finally, cleaned up and enforced the testing accessors via code and friend declarations BUG=460987 Committed: https://crrev.com/43eb02c2ffcfa18adfcbf34cd0507a3d7494febe Cr-Commit-Position: refs/heads/master@{#322609}

Patch Set 1 #

Patch Set 2 : IsIdInArray and other Cleanup #

Total comments: 6

Patch Set 3 : Convert STLCount to const ref argument #

Patch Set 4 : Sync to Latest #

Patch Set 5 : Remove Unsigned From Checks with STLCount #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+376 lines, -251 lines) Patch
M base/stl_util.h View 1 2 2 chunks +16 lines, -0 lines 2 comments Download
M chrome/browser/content_settings/content_settings_internal_extension_provider.cc View 1 1 chunk +3 lines, -3 lines 0 comments Download
M chrome/browser/extensions/api/tab_capture/tab_capture_api.cc View 1 1 chunk +2 lines, -4 lines 0 comments Download
M chrome/browser/extensions/external_component_loader.cc View 1 2 3 1 chunk +2 lines, -5 lines 0 comments Download
M extensions/browser/api/app_window/app_window_api.cc View 1 1 chunk +2 lines, -4 lines 0 comments Download
M extensions/common/features/base_feature_provider_unittest.cc View 1 2 3 4 3 chunks +17 lines, -11 lines 0 comments Download
M extensions/common/features/simple_feature.h View 1 5 chunks +88 lines, -53 lines 0 comments Download
M extensions/common/features/simple_feature.cc View 1 11 chunks +131 lines, -92 lines 0 comments Download
M extensions/common/features/simple_feature_unittest.cc View 1 2 3 4 30 chunks +115 lines, -79 lines 0 comments Download

Messages

Total messages: 41 (10 generated)
robliao
rockot: Please review the changes in c/b/e/* and e/*. Thanks.
5 years, 9 months ago (2015-03-26 01:03:26 UTC) #2
Ken Rockot(use gerrit already)
Have you considered using a base::hash_set instead? While it may consume more memory overall, I ...
5 years, 9 months ago (2015-03-26 01:14:58 UTC) #3
miu
On 2015/03/26 01:14:58, Ken Rockot wrote: > Have you considered using a base::hash_set instead? While ...
5 years, 9 months ago (2015-03-26 01:31:58 UTC) #4
Ken Rockot(use gerrit already)
On 2015/03/26 01:31:58, miu wrote: > On 2015/03/26 01:14:58, Ken Rockot wrote: > > Have ...
5 years, 9 months ago (2015-03-26 01:35:36 UTC) #5
Ken Rockot(use gerrit already)
Also: I do agree with your suggestion for IsIdInList! On Wed, Mar 25, 2015 at ...
5 years, 9 months ago (2015-03-26 01:37:17 UTC) #6
robliao
On 2015/03/26 01:37:17, Ken Rockot wrote: > Also: I do agree with your suggestion for ...
5 years, 9 months ago (2015-03-26 17:36:02 UTC) #7
Ken Rockot(use gerrit already)
The n might be small enough to be OK. These functions are called pretty often ...
5 years, 9 months ago (2015-03-26 17:51:44 UTC) #8
robliao
On 2015/03/26 17:51:44, Ken Rockot wrote: > The n might be small enough to be ...
5 years, 9 months ago (2015-03-26 18:08:31 UTC) #9
Ken Rockot(use gerrit already)
On 2015/03/26 18:08:31, robliao wrote: > On 2015/03/26 17:51:44, Ken Rockot wrote: > > The ...
5 years, 9 months ago (2015-03-26 18:15:32 UTC) #10
miu
Before you commit, please don't forget to change IsIdInList() as discussed. ;-)
5 years, 9 months ago (2015-03-26 18:46:16 UTC) #12
robliao
On 2015/03/26 18:46:16, miu wrote: > Before you commit, please don't forget to change IsIdInList() ...
5 years, 9 months ago (2015-03-26 18:47:57 UTC) #13
robliao
Added IsIdInArray, made IsIdInList private, and made platforms private. I considered unifying IsIdInArray and IsIdInList, ...
5 years, 9 months ago (2015-03-26 21:31:50 UTC) #15
robliao
thestig@chromium.org: Please review changes in stl_util.h and c/b/content* Thanks!
5 years, 9 months ago (2015-03-26 21:34:00 UTC) #17
Lei Zhang
https://codereview.chromium.org/1010973013/diff/40001/base/stl_util.h File base/stl_util.h (right): https://codereview.chromium.org/1010973013/diff/40001/base/stl_util.h#newcode97 base/stl_util.h:97: STLCount(const Container* const container, const T& val) { Can ...
5 years, 9 months ago (2015-03-26 21:48:45 UTC) #18
robliao
https://codereview.chromium.org/1010973013/diff/40001/base/stl_util.h File base/stl_util.h (right): https://codereview.chromium.org/1010973013/diff/40001/base/stl_util.h#newcode97 base/stl_util.h:97: STLCount(const Container* const container, const T& val) { On ...
5 years, 9 months ago (2015-03-26 21:51:48 UTC) #19
Lei Zhang
On 2015/03/26 21:51:48, robliao wrote: > https://codereview.chromium.org/1010973013/diff/40001/base/stl_util.h > File base/stl_util.h (right): > > https://codereview.chromium.org/1010973013/diff/40001/base/stl_util.h#newcode97 > ...
5 years, 9 months ago (2015-03-26 22:15:47 UTC) #20
robliao
On 2015/03/26 22:15:47, Lei Zhang wrote: > On 2015/03/26 21:51:48, robliao wrote: > > https://codereview.chromium.org/1010973013/diff/40001/base/stl_util.h ...
5 years, 9 months ago (2015-03-26 22:19:51 UTC) #21
Lei Zhang
On 2015/03/26 22:19:51, robliao wrote: > On 2015/03/26 22:15:47, Lei Zhang wrote: > > On ...
5 years, 9 months ago (2015-03-26 22:21:44 UTC) #22
miu
tab_capture_apitest.cc lgtm Other concerns: https://codereview.chromium.org/1010973013/diff/40001/base/stl_util.h File base/stl_util.h (right): https://codereview.chromium.org/1010973013/diff/40001/base/stl_util.h#newcode97 base/stl_util.h:97: STLCount(const Container* const container, const ...
5 years, 9 months ago (2015-03-26 22:24:43 UTC) #23
robliao
https://codereview.chromium.org/1010973013/diff/40001/base/stl_util.h File base/stl_util.h (right): https://codereview.chromium.org/1010973013/diff/40001/base/stl_util.h#newcode97 base/stl_util.h:97: STLCount(const Container* const container, const T& val) { On ...
5 years, 9 months ago (2015-03-26 23:15:50 UTC) #25
Lei Zhang
base/ lgtm
5 years, 9 months ago (2015-03-26 23:19:34 UTC) #26
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1010973013/80001
5 years, 9 months ago (2015-03-27 00:35:03 UTC) #29
commit-bot: I haz the power
Try jobs failed on following builders: linux_chromium_compile_dbg_32_ng on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_compile_dbg_32_ng/builds/37156)
5 years, 9 months ago (2015-03-27 02:48:23 UTC) #31
robliao
On 2015/03/27 02:48:23, I haz the power (commit-bot) wrote: > Try jobs failed on following ...
5 years, 9 months ago (2015-03-27 04:10:34 UTC) #32
robliao
On 2015/03/27 04:10:34, robliao wrote: > On 2015/03/27 02:48:23, I haz the power (commit-bot) wrote: ...
5 years, 9 months ago (2015-03-27 04:29:57 UTC) #33
robliao
Goofy part is that this doesn't repro on my local machine... Removed the unsigned constant ...
5 years, 9 months ago (2015-03-27 09:00:17 UTC) #34
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1010973013/120001
5 years, 9 months ago (2015-03-27 17:09:32 UTC) #37
commit-bot: I haz the power
Committed patchset #5 (id:120001)
5 years, 9 months ago (2015-03-27 18:25:19 UTC) #38
commit-bot: I haz the power
Patchset 5 (id:??) landed as https://crrev.com/43eb02c2ffcfa18adfcbf34cd0507a3d7494febe Cr-Commit-Position: refs/heads/master@{#322609}
5 years, 9 months ago (2015-03-27 18:26:15 UTC) #39
tfarina
https://codereview.chromium.org/1010973013/diff/120001/base/stl_util.h File base/stl_util.h (right): https://codereview.chromium.org/1010973013/diff/120001/base/stl_util.h#newcode209 base/stl_util.h:209: bool ContainsValue(const Collection& collection, const Value& value) { why ...
5 years, 8 months ago (2015-04-03 01:26:37 UTC) #40
robliao
5 years, 8 months ago (2015-04-03 17:15:32 UTC) #41
Message was sent while issue was closed.
https://codereview.chromium.org/1010973013/diff/120001/base/stl_util.h
File base/stl_util.h (right):

https://codereview.chromium.org/1010973013/diff/120001/base/stl_util.h#newcod...
base/stl_util.h:209: bool ContainsValue(const Collection& collection, const
Value& value) {
On 2015/04/03 01:26:37, tfarina wrote:
> why these and the above functions were not added to base namespace?

Consistency was the major driving factor. ContainsKey already lived in the
global namespace, so it was natural that ContainsValue would live there as well.
As for STLCount more STL* items lived outside of base namespace, so it was
majority wins.

I would agree that putting all of the functions here into something like
base::stl would be nice. That refactor would certainly be a large undertaking.

Powered by Google App Engine
This is Rietveld 408576698