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

Issue 957573002: Use hash map for tracked_objects::location (Closed)

Created:
5 years, 10 months ago by Simon Que
Modified:
5 years, 9 months ago
CC:
chromium-reviews, erikwright+watch_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Use hash map for tracked_objects::location Accessing the Location->Birth std::map takes up about 0.5% of the CPU cycles, according to recent data from ChromeOS-wide profiling. That is a LOT for Chrome, which contains a ton of stuff. Replacing it with a hash map cuts that down by 1/3 to 1/2. See the bug for more details. BUG=chromium:463700 Signed-off-by: Simon Que <sque@chromium.org>; Committed: https://crrev.com/e3b16f181ab489621ca9866f472e012e33b6e9c0 Cr-Commit-Position: refs/heads/master@{#320635}

Patch Set 1 #

Total comments: 4

Patch Set 2 : Updated hash function; disregard function_name_ during hash and compare #

Total comments: 12

Patch Set 3 : Addressed isherman's comments #

Total comments: 12

Patch Set 4 : Addressed comments #

Total comments: 4

Patch Set 5 : Removed operator< for Location #

Total comments: 2

Patch Set 6 : compactify hash function call #

Total comments: 2

Patch Set 7 : Call hash pair directly from header file #

Patch Set 8 : Cast hash inputs to 32-bits or 64-bits depending on arch #

Patch Set 9 : Cast line number to uintptr_t #

Patch Set 10 : Explicitly cast line number to uint32_t #

Total comments: 1

Patch Set 11 : explicit cast of file ptr to uint64_t #

Total comments: 2

Patch Set 12 : Fixed typos in comment #

Unified diffs Side-by-side diffs Delta from patch set Stats (+40 lines, -13 lines) Patch
M base/location.h View 1 2 3 4 5 6 7 8 9 10 11 3 chunks +31 lines, -12 lines 0 comments Download
M base/location.cc View 1 2 3 4 5 6 1 chunk +7 lines, -0 lines 0 comments Download
M base/tracked_objects.h View 1 2 3 4 5 2 chunks +2 lines, -1 line 0 comments Download

Messages

Total messages: 79 (18 generated)
vadimt
https://codereview.chromium.org/957573002/diff/1/base/location.cc File base/location.cc (right): https://codereview.chromium.org/957573002/diff/1/base/location.cc#newcode18 base/location.cc:18: uintptr_t function_name = (uintptr_t) location->function_name(); Same thing. https://codereview.chromium.org/957573002/diff/1/base/location.h File ...
5 years, 10 months ago (2015-02-26 00:16:25 UTC) #2
Simon Que
https://codereview.chromium.org/957573002/diff/1/base/location.cc File base/location.cc (right): https://codereview.chromium.org/957573002/diff/1/base/location.cc#newcode18 base/location.cc:18: uintptr_t function_name = (uintptr_t) location->function_name(); On 2015/02/26 00:16:24, vadimt ...
5 years, 10 months ago (2015-02-26 02:07:54 UTC) #3
Ilya Sherman
https://codereview.chromium.org/957573002/diff/20001/base/location.cc File base/location.cc (right): https://codereview.chromium.org/957573002/diff/20001/base/location.cc#newcode52 base/location.cc:52: hash += reinterpret_cast<uintptr_t>(file_name_); This is pretty surprising for a ...
5 years, 9 months ago (2015-03-03 04:48:24 UTC) #5
Ilya Sherman
Also, please file a bug for this work, and expand out the CL description so ...
5 years, 9 months ago (2015-03-03 04:53:20 UTC) #6
Simon Que
https://codereview.chromium.org/957573002/diff/20001/base/location.cc File base/location.cc (right): https://codereview.chromium.org/957573002/diff/20001/base/location.cc#newcode52 base/location.cc:52: hash += reinterpret_cast<uintptr_t>(file_name_); On 2015/03/03 04:48:23, Ilya Sherman wrote: ...
5 years, 9 months ago (2015-03-03 23:28:00 UTC) #7
Ilya Sherman
https://codereview.chromium.org/957573002/diff/40001/base/location.cc File base/location.cc (right): https://codereview.chromium.org/957573002/diff/40001/base/location.cc#newcode55 base/location.cc:55: // the definition of FROM_HERE in logging.h, and how ...
5 years, 9 months ago (2015-03-03 23:49:22 UTC) #9
vadimt
https://codereview.chromium.org/957573002/diff/40001/base/location.h File base/location.h (right): https://codereview.chromium.org/957573002/diff/40001/base/location.h#newcode44 base/location.h:44: return function_name_ < other.function_name_; Yes, this would be a ...
5 years, 9 months ago (2015-03-04 02:13:40 UTC) #10
Simon Que
https://codereview.chromium.org/957573002/diff/40001/base/location.cc File base/location.cc (right): https://codereview.chromium.org/957573002/diff/40001/base/location.cc#newcode55 base/location.cc:55: // the definition of FROM_HERE in logging.h, and how ...
5 years, 9 months ago (2015-03-04 02:15:37 UTC) #11
Ilya Sherman
Thanks, Simon. https://codereview.chromium.org/957573002/diff/60001/base/location.h File base/location.h (right): https://codereview.chromium.org/957573002/diff/60001/base/location.h#newcode44 base/location.h:44: return function_name_ < other.function_name_; IMO we should ...
5 years, 9 months ago (2015-03-04 02:25:26 UTC) #12
Simon Que
https://codereview.chromium.org/957573002/diff/60001/base/location.h File base/location.h (right): https://codereview.chromium.org/957573002/diff/60001/base/location.h#newcode44 base/location.h:44: return function_name_ < other.function_name_; On 2015/03/04 02:25:26, Ilya Sherman ...
5 years, 9 months ago (2015-03-04 02:36:22 UTC) #13
Ilya Sherman
https://codereview.chromium.org/957573002/diff/60001/base/location.h File base/location.h (right): https://codereview.chromium.org/957573002/diff/60001/base/location.h#newcode44 base/location.h:44: return function_name_ < other.function_name_; On 2015/03/04 02:36:22, Simon Que ...
5 years, 9 months ago (2015-03-04 04:08:24 UTC) #14
Simon Que
https://codereview.chromium.org/957573002/diff/60001/base/location.h File base/location.h (right): https://codereview.chromium.org/957573002/diff/60001/base/location.h#newcode44 base/location.h:44: return function_name_ < other.function_name_; On 2015/03/04 04:08:24, Ilya Sherman ...
5 years, 9 months ago (2015-03-04 04:59:30 UTC) #15
Ilya Sherman
LGTM, thanks.
5 years, 9 months ago (2015-03-04 05:04:30 UTC) #16
danakj
On 2015/03/03 04:53:20, Ilya Sherman wrote: > Also, please file a bug for this work, ...
5 years, 9 months ago (2015-03-04 16:54:41 UTC) #17
danakj
Looks like this change is motivated by performance. Can you collect performance data to demonstrate ...
5 years, 9 months ago (2015-03-04 16:56:52 UTC) #18
vadimt
lgtm
5 years, 9 months ago (2015-03-04 18:39:53 UTC) #19
Simon Que
On 2015/03/04 16:54:41, danakj wrote: > On 2015/03/03 04:53:20, Ilya Sherman wrote: > > Also, ...
5 years, 9 months ago (2015-03-04 19:08:50 UTC) #20
danakj
On Wed, Mar 4, 2015 at 11:08 AM, <sque@chromium.org> wrote: > On 2015/03/04 16:54:41, danakj ...
5 years, 9 months ago (2015-03-04 19:31:06 UTC) #21
Simon Que
On 2015/03/04 19:31:06, danakj wrote: > On Wed, Mar 4, 2015 at 11:08 AM, <mailto:sque@chromium.org> ...
5 years, 9 months ago (2015-03-04 19:35:15 UTC) #22
danakj
https://codereview.chromium.org/957573002/diff/80001/base/location.cc File base/location.cc (right): https://codereview.chromium.org/957573002/diff/80001/base/location.cc#newcode57 base/location.cc:57: BASE_HASH_NAMESPACE::hash<std::pair<uintptr_t, int>> hash_factory; Could this be more concisely written ...
5 years, 9 months ago (2015-03-11 17:04:06 UTC) #23
Simon Que
https://codereview.chromium.org/957573002/diff/80001/base/location.cc File base/location.cc (right): https://codereview.chromium.org/957573002/diff/80001/base/location.cc#newcode57 base/location.cc:57: BASE_HASH_NAMESPACE::hash<std::pair<uintptr_t, int>> hash_factory; On 2015/03/11 17:04:06, danakj wrote: > ...
5 years, 9 months ago (2015-03-11 17:34:49 UTC) #24
danakj
LGTM https://codereview.chromium.org/957573002/diff/100001/base/location.cc File base/location.cc (right): https://codereview.chromium.org/957573002/diff/100001/base/location.cc#newcode57 base/location.cc:57: return base::HashPair(reinterpret_cast<uintptr_t>(file_name_), line_number_); Cool, you could just do ...
5 years, 9 months ago (2015-03-11 17:37:41 UTC) #25
Simon Que
https://codereview.chromium.org/957573002/diff/100001/base/location.cc File base/location.cc (right): https://codereview.chromium.org/957573002/diff/100001/base/location.cc#newcode57 base/location.cc:57: return base::HashPair(reinterpret_cast<uintptr_t>(file_name_), line_number_); On 2015/03/11 17:37:41, danakj wrote: > ...
5 years, 9 months ago (2015-03-11 17:58:52 UTC) #26
danakj
LGTM
5 years, 9 months ago (2015-03-11 18:09:14 UTC) #27
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/957573002/120001
5 years, 9 months ago (2015-03-11 18:27:25 UTC) #30
commit-bot: I haz the power
Try jobs failed on following builders: ios_dbg_simulator_ninja on tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/ios_dbg_simulator_ninja/builds/4397)
5 years, 9 months ago (2015-03-11 18:32:21 UTC) #32
Simon Que
The build freezes with Patch Set 8. The static_assert apparently causes ninja build to freeze.
5 years, 9 months ago (2015-03-11 21:38:14 UTC) #33
Ilya Sherman
On 2015/03/11 21:38:14, Simon Que wrote: > The build freezes with Patch Set 8. The ...
5 years, 9 months ago (2015-03-11 21:41:25 UTC) #34
Simon Que
On 2015/03/11 21:41:25, Ilya Sherman wrote: > On 2015/03/11 21:38:14, Simon Que wrote: > > ...
5 years, 9 months ago (2015-03-11 21:42:02 UTC) #35
Ilya Sherman
On 2015/03/11 21:42:02, Simon Que wrote: > On 2015/03/11 21:41:25, Ilya Sherman wrote: > > ...
5 years, 9 months ago (2015-03-11 22:32:49 UTC) #36
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/957573002/160001
5 years, 9 months ago (2015-03-11 23:05:39 UTC) #39
Simon Que
On 2015/03/11 23:05:39, I haz the power (commit-bot) wrote: > CQ is trying da patch. ...
5 years, 9 months ago (2015-03-11 23:09:22 UTC) #40
commit-bot: I haz the power
Try jobs failed on following builders: ios_dbg_simulator_ninja on tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/ios_dbg_simulator_ninja/builds/4554) ios_rel_device_ninja on tryserver.chromium.mac (JOB_FAILED, ...
5 years, 9 months ago (2015-03-11 23:11:41 UTC) #42
danakj
On Wed, Mar 11, 2015 at 2:38 PM, <sque@chromium.org> wrote: > The build freezes with ...
5 years, 9 months ago (2015-03-11 23:43:39 UTC) #43
Simon Que
Chrome OS, see go/simplechrome. On Wed, Mar 11, 2015 at 4:43 PM, Dana Jansens <danakj@chromium.org> ...
5 years, 9 months ago (2015-03-11 23:48:31 UTC) #44
danakj
On Wed, Mar 11, 2015 at 4:48 PM, Simon Que <sque@chromium.org> wrote: > Chrome OS, ...
5 years, 9 months ago (2015-03-11 23:50:04 UTC) #45
Simon Que
Haven't tried, but that is one of the existing workflows for Chrome OS. On Wed, ...
5 years, 9 months ago (2015-03-11 23:53:15 UTC) #46
danakj
Maybe +thakis has some insight. Patchset 6 can't figure out what to convert uintptr_t to ...
5 years, 9 months ago (2015-03-11 23:55:16 UTC) #47
danakj
On 2015/03/11 23:55:16, danakj wrote: > Maybe +thakis has some insight. > > Patchset 6 ...
5 years, 9 months ago (2015-03-11 23:55:44 UTC) #48
danakj
Oh, silently failing to add people.. try again.. Maybe +thakis has some insight. Patchset 7 ...
5 years, 9 months ago (2015-03-11 23:56:55 UTC) #50
Ilya Sherman
On 2015/03/11 23:09:22, Simon Que wrote: > On 2015/03/11 23:05:39, I haz the power (commit-bot) ...
5 years, 9 months ago (2015-03-12 00:03:32 UTC) #51
Simon Que
On 2015/03/12 00:03:32, Ilya Sherman wrote: > On 2015/03/11 23:09:22, Simon Que wrote: > > ...
5 years, 9 months ago (2015-03-12 00:29:11 UTC) #52
Simon Que
What if we just forced it to be uint32 on all systems? The ptr is ...
5 years, 9 months ago (2015-03-12 00:38:06 UTC) #53
danakj
On Wed, Mar 11, 2015 at 5:37 PM, Simon Que <sque@chromium.org> wrote: > What if ...
5 years, 9 months ago (2015-03-12 00:39:49 UTC) #54
Nico
My guess for what's happening in patch set 7 is that we somehow pick up ...
5 years, 9 months ago (2015-03-12 03:13:28 UTC) #55
danakj
On Wed, Mar 11, 2015 at 8:13 PM, <thakis@chromium.org> wrote: > My guess for what's ...
5 years, 9 months ago (2015-03-12 16:52:32 UTC) #56
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/957573002/180001
5 years, 9 months ago (2015-03-12 17:53:49 UTC) #59
Nico
Alright, I'll patch this in and debug a bit. Mysterious.
5 years, 9 months ago (2015-03-12 17:58:20 UTC) #60
commit-bot: I haz the power
Try jobs failed on following builders: ios_dbg_simulator_ninja on tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/ios_dbg_simulator_ninja/builds/4831) ios_rel_device_ninja on tryserver.chromium.mac (JOB_FAILED, ...
5 years, 9 months ago (2015-03-12 18:04:21 UTC) #62
Nico
Ok, here's what's happening: # 30 "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/sys/_types/_uintptr_t.h" 3 4 typedef unsigned long uintptr_t; OS X ...
5 years, 9 months ago (2015-03-12 18:15:46 UTC) #63
danakj
Thanks for the help, Nico. On Thu, Mar 12, 2015 at 11:15 AM, <thakis@chromium.org> wrote: ...
5 years, 9 months ago (2015-03-12 18:19:44 UTC) #64
Simon Que
On 2015/03/12 18:15:46, Nico (traveling) wrote: > static_cast<uint64_t>(reinterpret_cast<uintptr_t>(...)) > > and then things should work. ...
5 years, 9 months ago (2015-03-12 23:45:47 UTC) #65
Nico
that should work too On Thu, Mar 12, 2015 at 7:45 PM, <sque@chromium.org> wrote: > ...
5 years, 9 months ago (2015-03-13 00:41:09 UTC) #66
danakj
https://codereview.chromium.org/957573002/diff/180001/base/location.h File base/location.h (right): https://codereview.chromium.org/957573002/diff/180001/base/location.h#newcode62 base/location.h:62: return base::HashPair(reinterpret_cast<uintptr_t>(location.file_name()), When you do said cast can you ...
5 years, 9 months ago (2015-03-13 17:43:40 UTC) #67
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/957573002/200001
5 years, 9 months ago (2015-03-13 21:29:34 UTC) #70
danakj
LGTM https://codereview.chromium.org/957573002/diff/200001/base/location.h File base/location.h (right): https://codereview.chromium.org/957573002/diff/200001/base/location.h#newcode64 base/location.h:64: // pltforms. The solution is to explicitly it ...
5 years, 9 months ago (2015-03-13 22:05:06 UTC) #71
Simon Que
https://codereview.chromium.org/957573002/diff/200001/base/location.h File base/location.h (right): https://codereview.chromium.org/957573002/diff/200001/base/location.h#newcode64 base/location.h:64: // pltforms. The solution is to explicitly it to ...
5 years, 9 months ago (2015-03-13 23:36:33 UTC) #73
Simon Que
https://codereview.chromium.org/957573002/diff/200001/base/location.h File base/location.h (right): https://codereview.chromium.org/957573002/diff/200001/base/location.h#newcode64 base/location.h:64: // pltforms. The solution is to explicitly it to ...
5 years, 9 months ago (2015-03-13 23:36:33 UTC) #74
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/957573002/220001
5 years, 9 months ago (2015-03-13 23:48:06 UTC) #77
commit-bot: I haz the power
Committed patchset #12 (id:220001)
5 years, 9 months ago (2015-03-14 02:39:15 UTC) #78
commit-bot: I haz the power
5 years, 9 months ago (2015-03-14 02:40:06 UTC) #79
Message was sent while issue was closed.
Patchset 12 (id:??) landed as
https://crrev.com/e3b16f181ab489621ca9866f472e012e33b6e9c0
Cr-Commit-Position: refs/heads/master@{#320635}

Powered by Google App Engine
This is Rietveld 408576698