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

Issue 22927018: Avoid fragmenting the heap too much while reconstructing the index. (Closed)

Created:
7 years, 4 months ago by Philippe
Modified:
7 years, 4 months ago
Reviewers:
pasko, clamy, gavinp
CC:
chromium-reviews, cbentzel+watch_chromium.org, gavinp+disk_chromium.org
Visibility:
Public.

Description

Avoid fragmenting the heap too much while reconstructing the index. Memory analysis exposed that FileEnumerator doesn't scale well on very large directories (e.g. ~80 000 entries) due to the high amount of heap allocations it is performing causing unexpectedly high heap fragmentation (e.g. ~5 MBytes with a 80 000 files directory). This CL makes SimpleIndexFile::SyncRestoreFromDisk() use directly readdir_r() on POSIX and fallback to FileEnumerator on Windows. The code path triggered for reconstructing the index from disk now causes a 40 KBytes RAM overhead (on the cache that was used for testing) vs the 5 initial MBytes. BUG=272062 R=gavinp@chromium.org, pasko@chromium.org Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=219017

Patch Set 1 : #

Total comments: 8

Patch Set 2 : Address Gavin's comments #

Patch Set 3 : Remove uses of vector::data() which is C++11 only #

Total comments: 13

Patch Set 4 : Address Egor's and Gavin's comments #

Total comments: 14

Patch Set 5 : Address Gavin's comment #

Patch Set 6 : Address Egor's comments #

Patch Set 7 : Speculative fix for Windows #

Patch Set 8 : Fix windows build (part 2) #

Unified diffs Side-by-side diffs Delta from patch set Stats (+161 lines, -60 lines) Patch
M net/disk_cache/simple/simple_index_file.h View 1 2 3 4 3 chunks +12 lines, -3 lines 0 comments Download
M net/disk_cache/simple/simple_index_file.cc View 1 2 3 4 5 6 7 6 chunks +59 lines, -55 lines 0 comments Download
A net/disk_cache/simple/simple_index_file_posix.cc View 1 2 3 1 chunk +52 lines, -0 lines 0 comments Download
A net/disk_cache/simple/simple_index_file_win.cc View 1 2 3 4 5 6 1 chunk +33 lines, -0 lines 0 comments Download
M net/disk_cache/simple/simple_util.h View 1 2 chunks +2 lines, -1 line 0 comments Download
M net/disk_cache/simple/simple_util.cc View 1 1 chunk +1 line, -1 line 0 comments Download
M net/net.gyp View 7 1 chunk +2 lines, -0 lines 0 comments Download

Messages

Total messages: 15 (0 generated)
Philippe
7 years, 4 months ago (2013-08-20 18:41:55 UTC) #1
gavinp
https://chromiumcodereview.appspot.com/22927018/diff/9001/net/disk_cache/simple/simple_index_file.h File net/disk_cache/simple/simple_index_file.h (right): https://chromiumcodereview.appspot.com/22927018/diff/9001/net/disk_cache/simple/simple_index_file.h#newcode143 net/disk_cache/simple/simple_index_file.h:143: std::string* buffer, I'm a bit confused at this buffer ...
7 years, 4 months ago (2013-08-20 18:53:23 UTC) #2
gavinp
https://codereview.chromium.org/22927018/diff/9001/net/disk_cache/simple/simple_index_file.cc File net/disk_cache/simple/simple_index_file.cc (right): https://codereview.chromium.org/22927018/diff/9001/net/disk_cache/simple/simple_index_file.cc#newcode374 net/disk_cache/simple/simple_index_file.cc:374: buffer->append(file_name); I know that we've set capacity(), but I'm ...
7 years, 4 months ago (2013-08-20 20:13:45 UTC) #3
Philippe
Thanks Gavin! https://codereview.chromium.org/22927018/diff/9001/net/disk_cache/simple/simple_index_file.cc File net/disk_cache/simple/simple_index_file.cc (right): https://codereview.chromium.org/22927018/diff/9001/net/disk_cache/simple/simple_index_file.cc#newcode374 net/disk_cache/simple/simple_index_file.cc:374: buffer->append(file_name); On 2013/08/20 20:13:45, gavinp wrote: > ...
7 years, 4 months ago (2013-08-21 09:37:33 UTC) #4
pasko
https://codereview.chromium.org/22927018/diff/33001/net/disk_cache/simple/simple_index_file.cc File net/disk_cache/simple/simple_index_file.cc (right): https://codereview.chromium.org/22927018/diff/33001/net/disk_cache/simple/simple_index_file.cc#newcode359 net/disk_cache/simple/simple_index_file.cc:359: if (strcmp(file_name, "index") && strcmp(file_name, "fake_index")) "the-real-index", reuse constants ...
7 years, 4 months ago (2013-08-21 11:37:56 UTC) #5
gavinp
Egor's elegant prose has convinced me that we can probably use base::FilePath here. However, if ...
7 years, 4 months ago (2013-08-21 11:49:46 UTC) #6
Philippe
Thanks guys! https://codereview.chromium.org/22927018/diff/33001/net/disk_cache/simple/simple_index_file.cc File net/disk_cache/simple/simple_index_file.cc (right): https://codereview.chromium.org/22927018/diff/33001/net/disk_cache/simple/simple_index_file.cc#newcode359 net/disk_cache/simple/simple_index_file.cc:359: if (strcmp(file_name, "index") && strcmp(file_name, "fake_index")) On ...
7 years, 4 months ago (2013-08-21 12:41:38 UTC) #7
gavinp
lgtm https://codereview.chromium.org/22927018/diff/39001/net/disk_cache/simple/simple_index_file.h File net/disk_cache/simple/simple_index_file.h (right): https://codereview.chromium.org/22927018/diff/39001/net/disk_cache/simple/simple_index_file.h#newcode127 net/disk_cache/simple/simple_index_file.h:127: int data_len, Nit: don't do this change. It's ...
7 years, 4 months ago (2013-08-21 15:31:58 UTC) #8
Philippe
Thanks Gavin! I'm waiting for you Egor before landing :) https://codereview.chromium.org/22927018/diff/39001/net/disk_cache/simple/simple_index_file.h File net/disk_cache/simple/simple_index_file.h (right): https://codereview.chromium.org/22927018/diff/39001/net/disk_cache/simple/simple_index_file.h#newcode127 ...
7 years, 4 months ago (2013-08-21 15:37:50 UTC) #9
pasko
some more annoyance from Egor .. :) https://codereview.chromium.org/22927018/diff/39001/net/disk_cache/simple/simple_index_file.cc File net/disk_cache/simple/simple_index_file.cc (right): https://codereview.chromium.org/22927018/diff/39001/net/disk_cache/simple/simple_index_file.cc#newcode86 net/disk_cache/simple/simple_index_file.cc:86: LOG(ERROR) << ...
7 years, 4 months ago (2013-08-21 16:03:17 UTC) #10
Philippe
Thanks Egor! https://codereview.chromium.org/22927018/diff/39001/net/disk_cache/simple/simple_index_file.cc File net/disk_cache/simple/simple_index_file.cc (right): https://codereview.chromium.org/22927018/diff/39001/net/disk_cache/simple/simple_index_file.cc#newcode86 net/disk_cache/simple/simple_index_file.cc:86: LOG(ERROR) << "unexpected file " << file_name_string; ...
7 years, 4 months ago (2013-08-21 16:20:58 UTC) #11
pasko
lgtm, thanks! https://codereview.chromium.org/22927018/diff/39001/net/disk_cache/simple/simple_index_file_posix.cc File net/disk_cache/simple/simple_index_file_posix.cc (right): https://codereview.chromium.org/22927018/diff/39001/net/disk_cache/simple/simple_index_file_posix.cc#newcode32 net/disk_cache/simple/simple_index_file_posix.cc:32: const ScopedDir dir(opendir(cache_path.value().c_str())); On 2013/08/21 16:20:58, Philippe ...
7 years, 4 months ago (2013-08-21 16:29:27 UTC) #12
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/pliard@chromium.org/22927018/34008
7 years, 4 months ago (2013-08-22 11:09:44 UTC) #13
Philippe
Committed patchset #8 manually as r219017 (presubmit successful).
7 years, 4 months ago (2013-08-22 14:24:35 UTC) #14
gavinp
7 years, 4 months ago (2013-08-22 14:33:17 UTC) #15
+congratbot


On Thu, Aug 22, 2013 at 10:24 AM, <pliard@chromium.org> wrote:

> Committed patchset #8 manually as r219017 (presubmit successful).
>
>
https://codereview.chromium.**org/22927018/<https://codereview.chromium.org/2...
>

To unsubscribe from this group and stop receiving emails from it, send an email
to chromium-reviews+unsubscribe@chromium.org.

Powered by Google App Engine
This is Rietveld 408576698