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

Issue 1255293006: Microoptimisation for OnLibeventNotification. (Closed)

Created:
5 years, 4 months ago by Adam Rice
Modified:
5 years, 4 months ago
Reviewers:
hiroshige, Lei Zhang
CC:
chromium-reviews, erikwright+watch_chromium.org, sadrul
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Microoptimisation for OnLibeventNotification. OnLibeventNotification created a weak ptr to check that OnFileCanWriteWithoutBlocking() has not deleted theFileDescriptorWatcher object. Creating a WeakPtr performs an allocation. OnLibeventNotification is called often enough that it accounted for roughly 5% of the allocations performed by the browser. The allocation can be avoided by using a boolean variable to flag whether or not the FileDescriptorWatcher object has been destroyed. Furthermore, when only one of OnFileCanWriteWithoutBlocking() and OnFileCanReadWithoutBlocking() is going to be called, it is not necessary to check whether the FileDescriptorWatcher has been destroyed at all. Results from running the IPCChannelPerfTest.ChannelPingPong performance test with and without this change (all times in ms): IPC_Channel_Perf_50000x_12: 542.8 (s = 6.1) to 524.5 (s = 4.0) IPC_Channel_Perf_50000x_144: 552.8 (s = 6.8) to 537.2 (s = 5.1) IPC_Channel_Perf_50000x_1728: 572.5 (s = 6.7) to 553.7 (s = 6.7) IPC_Channel_Perf_12000x_20736: 305.7 (s = 4.2) to 305.1 (s = 3.2) IPC_Channel_Perf_1000x_248832: 365.0 (s = 3.7) to 361.3 (s = 2.9) My test environment was too noisy to demonstrate a statistically significant improvement on the last two cases, but I think it should be possible. BUG= TEST=base_unittests, net_unittests Committed: https://crrev.com/9ea8ee354b50ab621ea663636c5fc7a91c8e3226 Cr-Commit-Position: refs/heads/master@{#342076}

Patch Set 1 #

Patch Set 2 : Fix the logic for creating the weak pointer. #

Patch Set 3 : Eliminate WeakPtr completely. #

Patch Set 4 : Try to improve readability by separating the cases. #

Total comments: 6

Patch Set 5 : Minor changes requested by thestig@. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+25 lines, -12 lines) Patch
M base/message_loop/message_pump_libevent.h View 1 2 3 4 2 chunks +3 lines, -2 lines 0 comments Download
M base/message_loop/message_pump_libevent.cc View 1 2 3 4 2 chunks +22 lines, -10 lines 0 comments Download

Messages

Total messages: 25 (8 generated)
Adam Rice
5 years, 4 months ago (2015-07-30 13:05:57 UTC) #2
hiroshige
On 2015/07/30 13:05:57, Adam Rice wrote: Looks working, but can we avoid introducing a custom ...
5 years, 4 months ago (2015-07-31 06:36:57 UTC) #3
Adam Rice
On 2015/07/31 06:36:57, hiroshige wrote: > On 2015/07/30 13:05:57, Adam Rice wrote: > Looks working, ...
5 years, 4 months ago (2015-07-31 07:06:40 UTC) #4
hiroshige
> Unfortunately, the case of checking the socket for read and write at the same ...
5 years, 4 months ago (2015-08-03 08:32:39 UTC) #5
Adam Rice
Sorry to be a nuisance. Could you look at Patch Set 4 and see if ...
5 years, 4 months ago (2015-08-04 20:43:52 UTC) #6
hiroshige
On 2015/08/04 20:43:52, Adam Rice wrote: > Sorry to be a nuisance. Could you look ...
5 years, 4 months ago (2015-08-05 05:02:56 UTC) #7
Adam Rice
+thestig, could you review this for //base OWNERS?
5 years, 4 months ago (2015-08-05 23:16:25 UTC) #9
Lei Zhang
Neat find, lgtm. https://codereview.chromium.org/1255293006/diff/60001/base/message_loop/message_pump_libevent.cc File base/message_loop/message_pump_libevent.cc (right): https://codereview.chromium.org/1255293006/diff/60001/base/message_loop/message_pump_libevent.cc#newcode359 base/message_loop/message_pump_libevent.cc:359: if ((flags & (EV_WRITE | EV_READ)) ...
5 years, 4 months ago (2015-08-05 23:59:58 UTC) #10
Adam Rice
https://codereview.chromium.org/1255293006/diff/60001/base/message_loop/message_pump_libevent.cc File base/message_loop/message_pump_libevent.cc (right): https://codereview.chromium.org/1255293006/diff/60001/base/message_loop/message_pump_libevent.cc#newcode359 base/message_loop/message_pump_libevent.cc:359: if ((flags & (EV_WRITE | EV_READ)) == (EV_WRITE | ...
5 years, 4 months ago (2015-08-06 00:46:46 UTC) #11
Lei Zhang
++lgtm
5 years, 4 months ago (2015-08-06 02:18:21 UTC) #12
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1255293006/80001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1255293006/80001
5 years, 4 months ago (2015-08-06 02:27:13 UTC) #15
commit-bot: I haz the power
Try jobs failed on following builders: win_chromium_rel_ng on tryserver.chromium.win (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.win/builders/win_chromium_rel_ng/builds/89469)
5 years, 4 months ago (2015-08-06 05:25:21 UTC) #17
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1255293006/80001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1255293006/80001
5 years, 4 months ago (2015-08-06 05:51:38 UTC) #19
commit-bot: I haz the power
Try jobs failed on following builders: win_chromium_rel_ng on tryserver.chromium.win (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.win/builders/win_chromium_rel_ng/builds/89532)
5 years, 4 months ago (2015-08-06 07:19:23 UTC) #21
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1255293006/80001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1255293006/80001
5 years, 4 months ago (2015-08-06 07:21:38 UTC) #23
commit-bot: I haz the power
Committed patchset #5 (id:80001)
5 years, 4 months ago (2015-08-06 08:19:18 UTC) #24
commit-bot: I haz the power
5 years, 4 months ago (2015-08-06 08:19:57 UTC) #25
Message was sent while issue was closed.
Patchset 5 (id:??) landed as
https://crrev.com/9ea8ee354b50ab621ea663636c5fc7a91c8e3226
Cr-Commit-Position: refs/heads/master@{#342076}

Powered by Google App Engine
This is Rietveld 408576698