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

Issue 1783113002: Subzero: Improve the behavior of resizing vectors. (Closed)

Created:
4 years, 9 months ago by Jim Stichnoth
Modified:
4 years, 9 months ago
Reviewers:
Eric Holk, Karl, sehr, John
CC:
native-client-reviews_googlegroups.com
Base URL:
https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Target Ref:
refs/heads/master
Visibility:
Public.

Description

Subzero: Improve the behavior of resizing vectors. In some cases, Subzero needs to insert into a std::vector at a particular index, resizing the vector as necessary. It appears that our vector implementation sets the capacity to exactly the size when growing the vector, without leaving any extra capacity. This causes lots of mallocs and recopies each time the vector size is increased. (Adding elements via push_back() or emplace_back() doesn't seem to have that behavior.) We help this by reserving some extra space before resizing - bump to the next power of 2 up to some point, then bump to the next multiple of a chunk size beyond that point. BUG= https://bugs.chromium.org/p/nativeclient/issues/detail?id=4360 R=kschimpf@google.com Committed: https://gerrit.chromium.org/gerrit/gitweb?p=native_client/pnacl-subzero.git;a=commit;h=2f00bf6d866b33c9cf57e74a663bf771095ecc6b

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+42 lines, -15 lines) Patch
M src/IceAssemblerX86BaseImpl.h View 1 chunk +1 line, -1 line 0 comments Download
M src/IceGlobalContext.cpp View 1 chunk +1 line, -1 line 0 comments Download
M src/IceUtils.h View 5 chunks +38 lines, -11 lines 0 comments Download
M src/PNaClTranslator.cpp View 2 chunks +2 lines, -2 lines 0 comments Download

Messages

Total messages: 7 (4 generated)
Jim Stichnoth
4 years, 9 months ago (2016-03-11 01:57:24 UTC) #4
Karl
lgtm
4 years, 9 months ago (2016-03-11 15:26:18 UTC) #5
Jim Stichnoth
4 years, 9 months ago (2016-03-11 22:59:47 UTC) #7
Message was sent while issue was closed.
Committed patchset #1 (id:1) manually as
2f00bf6d866b33c9cf57e74a663bf771095ecc6b (presubmit successful).

Powered by Google App Engine
This is Rietveld 408576698