Pickle::Write* micro-optimizations
Pickle is hot in some benchmarks. This helps by reworking WriteBytes in a few of ways:
1- Fold BeginWrite and EndWrite into WriteBytes since it's the only caller now.
2- keep track of the write offset, always aligned, separately, so that we can do alignment checks on the field sizes rather than the payload size (for next point).
3- provides a template version of WriteBytes with specializations for predefined sizes, that inline/optimize away alignment checks, padding, and memcpy.
4- change the meaning of capacity_ to not take the header size into account. This simplifies some arithmetic.
BUG=307480
R=jar@chromium.org
Review URL: https://codereview.chromium.org/34413002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@231987 0039d316-1c4b-4281-b951-d872f2087c98
CrOS-Libchrome-Original-Commit: d1b319fc3f77e744fb325a5a28b6ae448072a9ae
3 files changed