Chromium Code Reviews
DescriptionRemove std::string histogram name from HistogramBase object.
The std::string implementation is frequently around 28 or 40 bytes
(on 32/64-bit builds) in order to hold small strings without having to
allocate external memory. Not only do histogram names typically exceed
that amount but most strings are code constants to begin with. Also,
when persistent histograms are used, the name is copied to persistent
memory meaning that there are frequently 2 ram copies of code constant
strings and 28 bytes of space wasted per histogram object.
Instead, keep only a "const char*" for the histogram name and use
other mechanisms to ensure its permanence should it not be persistent
and not be a code constant.
The resulting savings is 24 (of 64) bytes in HistogramBase on 32-bit
builds and 32 (of 104) bytes on 64-bit. The Histogram object is thus
reduced from 88/136 bytes to 64/104 bytes.
Basically, the size of all Histogram objects is cut in half plus a
reduction in external strings.
These measurements were done on Windows. Other implementations of
std::string may not have the small-string optimization and thus the
reduction may be as little as one machine word.
BUG=733380
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.android:android_optional_gpu_tests_rel;master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel
Patch Set 1 #Patch Set 2 : rebased #Patch Set 3 : never rely on outside string permanence #
Total comments: 2
Patch Set 4 : rebased #Patch Set 5 : fixed outside references to histogram_name() #Patch Set 6 : fixed outside references to histogram_name() #Patch Set 7 : rebased #Patch Set 8 : rebased #Patch Set 9 : rebased #Messages
Total messages: 53 (48 generated)
|