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

Issue 2789683002: Speed up SimpleCache eviction set computation (Closed)

Created:
3 years, 8 months ago by Maks Orlovich
Modified:
3 years, 8 months ago
Reviewers:
pasko, jkarlin
CC:
chromium-reviews, cbentzel+watch_chromium.org, gavinp+disk_chromium.org, net-reviews_chromium.org
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

Speed up SimpleCache eviction set computation The code previously used to collect hash keys into vector and sort that by LRU order, which required indexing into the hash table on every comparison. Instead, collect pointers into the hashtable (which are same size), to avoid the hash lookups. CPU impact: new SimpleIndexPerfTest, EvictionPerformance ubenchmark: 4.82ms -> 0.33ms on Linux/clang workstation 9.26ms -> 0.64ms on Windows/MSVC laptop (With 10K entries) Memory usage impact: Let N = number of entries in cache. E = number of entries evicted, which is usually around N/20. My workstation currently has 16325 entries in cache, which is within the "not-surprising" range, so I'll plug N=16000 plus corresponding E=800 into formulas to eyeball numbers. 32-bit: Peak/short-term usage (not counting any vector rounding) goes from: 8*N -> 4*N + 8*E e.g. 128,000 -> 70,400 Long-term, while I/O going on, usage goes from: 8*N -> 8*E e.g. 128,000 -> 6,400 64-bit: Shurt-term 8*N -> 8*N + 8*E e.g. 128,000 -> 134,400 Long-term, while I/O going on, usage goes from: 8*N -> 8*E e.g. 128,000 -> 6,400 BUG=706878 Review-Url: https://codereview.chromium.org/2789683002 Cr-Commit-Position: refs/heads/master@{#461815} Committed: https://chromium.googlesource.com/chromium/src/+/c348edb0c510441efe4ae5b8b1cfccc47f3c15ce

Patch Set 1 #

Total comments: 17

Patch Set 2 : Apply review feedback. #

Total comments: 6

Patch Set 3 : git cl try #

Unified diffs Side-by-side diffs Delta from patch set Stats (+78 lines, -40 lines) Patch
M net/disk_cache/disk_cache_perftest.cc View 1 2 2 chunks +40 lines, -0 lines 0 comments Download
M net/disk_cache/simple/simple_index.h View 1 2 2 chunks +9 lines, -0 lines 0 comments Download
M net/disk_cache/simple/simple_index.cc View 1 2 3 chunks +29 lines, -40 lines 0 comments Download

Messages

Total messages: 36 (21 generated)
Maks Orlovich
Windows numbers, on a slowish test laptop: ~25ms -> ~12ms The GetLastUsedTime tweak gets it ...
3 years, 8 months ago (2017-03-30 18:51:29 UTC) #3
Maks Orlovich
Please see some of the above comments re: potential tweak as well.
3 years, 8 months ago (2017-03-30 18:52:14 UTC) #5
pasko
overall simplecache part looks good, asking for a more elaborate benchmark thank you for taking ...
3 years, 8 months ago (2017-03-31 17:41:56 UTC) #8
Maks Orlovich
https://codereview.chromium.org/2789683002/diff/1/net/disk_cache/disk_cache_perftest.cc File net/disk_cache/disk_cache_perftest.cc (right): https://codereview.chromium.org/2789683002/diff/1/net/disk_cache/disk_cache_perftest.cc#newcode337 net/disk_cache/disk_cache_perftest.cc:337: LOG(ERROR) << "Took:" << timer.Elapsed().InMillisecondsF() << "ms"; On 2017/03/31 ...
3 years, 8 months ago (2017-03-31 19:01:30 UTC) #9
pasko
looks really nice now! my remaining notes are about nits, and stylistic sugar, and random ...
3 years, 8 months ago (2017-04-03 09:39:08 UTC) #15
Maks Orlovich
https://codereview.chromium.org/2789683002/diff/20001/net/disk_cache/disk_cache_perftest.cc File net/disk_cache/disk_cache_perftest.cc (right): https://codereview.chromium.org/2789683002/diff/20001/net/disk_cache/disk_cache_perftest.cc#newcode333 net/disk_cache/disk_cache_perftest.cc:333: i, disk_cache::EntryMetadata(start + base::TimeDelta::FromSeconds(i), On 2017/04/03 09:39:08, pasko wrote: ...
3 years, 8 months ago (2017-04-03 14:32:40 UTC) #17
Maks Orlovich
> Reasons I can see: > 1. with const iterations there is less code I ...
3 years, 8 months ago (2017-04-03 14:33:28 UTC) #18
pasko
lgtm
3 years, 8 months ago (2017-04-03 17:25:05 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/2789683002/40001
3 years, 8 months ago (2017-04-03 18:43:07 UTC) #25
commit-bot: I haz the power
Try jobs failed on following builders: chromium_presubmit on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/chromium_presubmit/builds/401200)
3 years, 8 months ago (2017-04-03 19:01:41 UTC) #27
Maks Orlovich
Looks like I need an owner for disk_cache_perftest.cc
3 years, 8 months ago (2017-04-03 19:04:31 UTC) #28
Maks Orlovich
Josh, could you take a look as well? Looks like I need non-SimpleCache approval due ...
3 years, 8 months ago (2017-04-03 19:09:42 UTC) #30
jkarlin
disk_cache_perftest.cc lgtm
3 years, 8 months ago (2017-04-04 18:39:52 UTC) #31
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/2789683002/40001
3 years, 8 months ago (2017-04-04 18:48:35 UTC) #33
commit-bot: I haz the power
3 years, 8 months ago (2017-04-04 20:24:25 UTC) #36
Message was sent while issue was closed.
Committed patchset #3 (id:40001) as
https://chromium.googlesource.com/chromium/src/+/c348edb0c510441efe4ae5b8b1cf...

Powered by Google App Engine
This is Rietveld 408576698