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 2670843007: Get rid of quadratic behavior in ResourceScheduler (Closed)

Created:
3 years, 10 months ago by Charlie Harrison
Modified:
3 years, 10 months ago
Reviewers:
kinuko
CC:
chromium-reviews, loading-reviews_chromium.org, jam, darin-cc_chromium.org, Randy Smith (Not in Mondays), mmenke
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Get rid of quadratic behavior in ResourceScheduler The ResourceScheduler often receives bursts of IPCs from the renderer, which call LoadAnyStartablePendingRequests. This method is O(n) for n pending requests for that client/tab. Because the IPCs are busty, we often have a message queue of m messages, each one calling into LoadAnyStartablePendingRequests, yielding O(m*n) behavior. This patch removes the O(m*n) behavior. As soon as one of these "bursty" messages is handled, we schedule a new task to call LoadAnyStartablePendingRequests. If the message queue has m messages queued up, this will put the call to LoadAnyStartablePendingRequests at the end. By ensuring we only have one scheduled task to load the startable requests, we effectively coalesce all of the other calls into this method. Another technique to remove this inefficiency would be to batch the IPC messages into one. This is being explored by kinuko@ in issue 672370. This approach however is very simple, and could easily be removed if we move to a batching system. BUG=664174 Review-Url: https://codereview.chromium.org/2670843007 Cr-Commit-Position: refs/heads/master@{#448634} Committed: https://chromium.googlesource.com/chromium/src/+/59501351d872c1348665ad6dfd23b09396821056

Patch Set 1 #

Patch Set 2 : Get rid of O(n^2) behavior in ResourceScheduler #

Patch Set 3 : properly initialize members, more comment #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+30 lines, -6 lines) Patch
M content/browser/loader/resource_scheduler.cc View 1 2 6 chunks +30 lines, -6 lines 2 comments Download

Messages

Total messages: 30 (20 generated)
Charlie Harrison
Hey Kinuko, WDYT about this approach to make resource scheduler a bit more CPU friendly ...
3 years, 10 months ago (2017-02-05 22:11:03 UTC) #18
Charlie Harrison
Hey Kinuko, WDYT about this approach to make resource scheduler a bit more CPU friendly ...
3 years, 10 months ago (2017-02-05 22:11:03 UTC) #19
kinuko
Looks reasonable, but I'm a bit concerned about how this might change the behavior. https://codereview.chromium.org/2670843007/diff/40001/content/browser/loader/resource_scheduler.cc ...
3 years, 10 months ago (2017-02-06 20:57:14 UTC) #20
Charlie Harrison
https://codereview.chromium.org/2670843007/diff/40001/content/browser/loader/resource_scheduler.cc File content/browser/loader/resource_scheduler.cc (right): https://codereview.chromium.org/2670843007/diff/40001/content/browser/loader/resource_scheduler.cc#newcode738 content/browser/loader/resource_scheduler.cc:738: weak_ptr_factory_.GetWeakPtr(), trigger)); On 2017/02/06 20:57:14, kinuko wrote: > This ...
3 years, 10 months ago (2017-02-06 21:24:29 UTC) #21
kinuko
On 2017/02/06 21:24:29, Charlie Harrison wrote: > https://codereview.chromium.org/2670843007/diff/40001/content/browser/loader/resource_scheduler.cc > File content/browser/loader/resource_scheduler.cc (right): > > https://codereview.chromium.org/2670843007/diff/40001/content/browser/loader/resource_scheduler.cc#newcode738 ...
3 years, 10 months ago (2017-02-07 05:19:15 UTC) #22
Charlie Harrison
On 2017/02/07 05:19:15, kinuko wrote: > On 2017/02/06 21:24:29, Charlie Harrison wrote: > > > ...
3 years, 10 months ago (2017-02-07 05:59:10 UTC) #23
kinuko
On 2017/02/07 05:59:10, Charlie Harrison wrote: > On 2017/02/07 05:19:15, kinuko wrote: > > On ...
3 years, 10 months ago (2017-02-07 06:34:16 UTC) #24
Charlie Harrison
I am hoping page cyclers will catch regressions or perf improvements. Other than that I ...
3 years, 10 months ago (2017-02-07 14:59:07 UTC) #25
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/2670843007/40001
3 years, 10 months ago (2017-02-07 15:04:20 UTC) #27
commit-bot: I haz the power
3 years, 10 months ago (2017-02-07 16:03:22 UTC) #30
Message was sent while issue was closed.
Committed patchset #3 (id:40001) as
https://chromium.googlesource.com/chromium/src/+/59501351d872c1348665ad6dfd23...

Powered by Google App Engine
This is Rietveld 408576698