Bug 1397376 - Reduce size of gExponentialBucketLowerBoundIndex r=gfritzsche
authorDoug Thayer <dothayer@mozilla.com>
Thu, 07 Sep 2017 10:23:52 -0700
changeset 429654 ba149daae44e54bbe19f0c78845654e94bc47cad
parent 429653 34d4d0192028f839ca2386bb4ec54ea10e2478f0
child 429655 447ae1ff1b04e206ae78d05d7333c8b3fda90f1e
push id7761
push userjlund@mozilla.com
push dateFri, 15 Sep 2017 00:19:52 +0000
treeherdermozilla-beta@c38455951db4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgfritzsche
bugs1397376
milestone57.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1397376 - Reduce size of gExponentialBucketLowerBoundIndex r=gfritzsche This is a fairly small optimization - since the indices for this array never exceed the size of an int16_t, let's just use that instead to save a little bit of space. MozReview-Commit-ID: 8bRokjlvZ9p
toolkit/components/telemetry/gen-histogram-data.py
--- a/toolkit/components/telemetry/gen-histogram-data.py
+++ b/toolkit/components/telemetry/gen-histogram-data.py
@@ -166,17 +166,20 @@ def write_exponential_histogram_ranges(o
         if histogram.kind() == 'exponential':
             ranges = tuple(histogram.ranges())
             if ranges not in ranges_offsets:
                 ranges_offsets[ranges] = offset
                 offset += histogram.n_buckets()
                 print(','.join(map(str, ranges)), ',', file=output)
     print("};", file=output)
 
-    print("const int gExponentialBucketLowerBoundIndex[] = {", file=output)
+    if offset > 32767:
+        raise Exception('Histogram offsets exceeded maximum value for an int16_t.')
+
+    print("const int16_t gExponentialBucketLowerBoundIndex[] = {", file=output)
     for histogram in histograms:
         cpp_guard = histogram.cpp_guard()
         if cpp_guard:
             print("#if defined(%s)" % cpp_guard, file=output)
 
         if histogram.kind() == 'exponential':
             our_offset = ranges_offsets[tuple(histogram.ranges())]
             print("%d," % our_offset, file=output)