diff options
author | danakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-10-29 22:23:52 +0000 |
---|---|---|
committer | danakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-10-29 22:23:52 +0000 |
commit | 032bfc439fbac7f08f562d6914b960008ce64bd4 (patch) | |
tree | f0011d01ec93997c514ffa64812bf4747d973dad /base/pickle.cc | |
parent | 594401ea5766f50d8bb9d3e5a2acf3df271a3ece (diff) | |
download | chromium_src-032bfc439fbac7f08f562d6914b960008ce64bd4.zip chromium_src-032bfc439fbac7f08f562d6914b960008ce64bd4.tar.gz chromium_src-032bfc439fbac7f08f562d6914b960008ce64bd4.tar.bz2 |
IPC pickling optimization for render passes.
Call Pickle::Reserve() for the size of the data in the shared quad
state and quad lists. This prevents the WriteFoo() invocations for
all of the quad/shared quad states from causing memory re-allocations
and moves.
This is based on https://codereview.chromium.org/34413002/ from piman@.
This is also based after https://codereview.chromium.org/30593005/ and
perf numbers (both before and after) include that CL also.
content_perftest results on linux chromeos release official build:
BEFORE
*RESULT mean_frame_serialization_time: DelegatedFrame_ManyQuads_1_4000= 50 us
*RESULT mean_frame_serialization_time: DelegatedFrame_ManyQuads_1_100000= 1888 us
*RESULT mean_frame_serialization_time: DelegatedFrame_ManyQuads_4000_4000= 728 us
*RESULT mean_frame_serialization_time: DelegatedFrame_ManyQuads_100000_100000= 23771 us
*RESULT mean_frame_serialization_time: DelegatedFrame_ManyRenderPasses_10000_100= 24118 us
AFTER
*RESULT mean_frame_serialization_time: DelegatedFrame_ManyQuads_1_4000= 48 us
*RESULT mean_frame_serialization_time: DelegatedFrame_ManyQuads_1_100000= 1626 us
*RESULT mean_frame_serialization_time: DelegatedFrame_ManyQuads_4000_4000= 460 us
*RESULT mean_frame_serialization_time: DelegatedFrame_ManyQuads_100000_100000= 14771 us
*RESULT mean_frame_serialization_time: DelegatedFrame_ManyRenderPasses_10000_100= 15626 us
This gives a further ~1.5x improvement in serialization time for shared quad
states and render passes.
R=jar@chromium.org, piman@chromium.org, tsepez@chromium.org, piman
BUG=307480
Review URL: https://codereview.chromium.org/35893002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@231656 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/pickle.cc')
-rw-r--r-- | base/pickle.cc | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/base/pickle.cc b/base/pickle.cc index 1d300b9..db78a4d 100644 --- a/base/pickle.cc +++ b/base/pickle.cc @@ -304,8 +304,18 @@ void Pickle::TrimWriteData(int new_length) { *cur_length = new_length; } +void Pickle::Reserve(size_t additional_capacity) { + // Write at a uint32-aligned offset from the beginning of the header. + size_t offset = AlignInt(header_->payload_size, sizeof(uint32)); + + size_t new_size = offset + additional_capacity; + size_t needed_size = header_size_ + new_size; + if (needed_size > capacity_) + Resize(capacity_ * 2 + needed_size); +} + char* Pickle::BeginWrite(size_t length) { - // write at a uint32-aligned offset from the beginning of the header + // Write at a uint32-aligned offset from the beginning of the header. size_t offset = AlignInt(header_->payload_size, sizeof(uint32)); size_t new_size = offset + length; |