Save 166 KB of per-process private data by deleting 'const'
Also saves a total of 224 KB of code.
VC++ has an odd quirk where if you have a const array of structs where the
structs have some const members then the compiler stores the array in
the .data (read/write section) instead of the .rdata (read-only
section). Worse yet, in this case the compiler generates code to do the
initialization, even in full official builds. This wastes code/reloc
space and also means that the arrays all turn into per-process private
data. That is, every Chrome process was ending up with a private copy of
the many global arrays which this change fixes.
This anomaly was discovered while investigating why a couple of large
const arrays were in the wrong section. The section size improvements
for full official build are shown below:
chrome.dll
.text: -111744 bytes change
.rdata: 165824 bytes change
.data: -166208 bytes change
.reloc: -23864 bytes change
Total change: -135992 bytes
chrome_child.dll
.text: -111904 bytes change
.rdata: 166000 bytes change
.data: -166240 bytes change
.reloc: -23832 bytes change
Total change: -135976 bytes
The on-disk size of each binary shrinks by 88,576 bytes. I do not
understand any of the math behind how section sizes map to binary sizes.
The VC++ tracking bug is:
https://connect.microsoft.com/VisualStudio/feedback/details/3117602
BUG=677351
Review-Url: https://codereview.chromium.org/2607893002
Cr-Commit-Position: refs/heads/master@{#441211}
1 file changed