Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(24)

Issue 167343002: Make code generated for histogram macros more compact. (Closed)

Created:
6 years, 10 months ago by Alexei Svitkine (slow)
Modified:
6 years, 10 months ago
CC:
chromium-reviews, erikwright+watch_chromium.org, Ilya Sherman, jar (doing other things), asvitkine+watch_chromium.org
Visibility:
Public.

Description

Make code generated for histogram macros more compact. In builds where DCHECKs are compiled in (e.g. developer builds and Chrome Canaries), the DCHECK_EQ() in the histogram macro was expanding to a lot of generated machine code. This CL moves that DCHECK() to a function instead, so that the code is not duplicated in every call site. The function call is wrapped behind a DCHECK_IS_ON() conditional, so that it will still be omitted if DCHECKs are not compiled into the build. Makes my Chromium release build smaller by over 1MB, measuring size of Chromium Framework. Before size: 146547380 After size: 145400692 BUG=343946 TEST=No functional changes. Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=251486

Patch Set 1 : #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+16 lines, -6 lines) Patch
M base/metrics/histogram.h View 1 chunk +2 lines, -2 lines 1 comment Download
M base/metrics/histogram_base.h View 4 chunks +9 lines, -3 lines 0 comments Download
M base/metrics/histogram_base.cc View 2 chunks +5 lines, -1 line 0 comments Download

Messages

Total messages: 10 (0 generated)
Alexei Svitkine (slow)
6 years, 10 months ago (2014-02-14 18:22:47 UTC) #1
Ilya Sherman
Nice. LGTM, thanks.
6 years, 10 months ago (2014-02-14 21:45:38 UTC) #2
Ilya Sherman
The CQ bit was checked by isherman@chromium.org
6 years, 10 months ago (2014-02-14 21:45:43 UTC) #3
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/asvitkine@chromium.org/167343002/60001
6 years, 10 months ago (2014-02-14 21:51:57 UTC) #4
jar (doing other things)
https://codereview.chromium.org/167343002/diff/60001/base/metrics/histogram.h File base/metrics/histogram.h (right): https://codereview.chromium.org/167343002/diff/60001/base/metrics/histogram.h#newcode158 base/metrics/histogram.h:158: if (DCHECK_IS_ON()) \ Am I correct, that this is ...
6 years, 10 months ago (2014-02-15 00:50:42 UTC) #5
Alexei Svitkine (slow)
See my CL description. It affects developer release builds too, and any builds where dchecks ...
6 years, 10 months ago (2014-02-15 01:04:52 UTC) #6
commit-bot: I haz the power
Change committed as 251486
6 years, 10 months ago (2014-02-15 03:11:50 UTC) #7
jar (doing other things)
FWIW I'm pretty sure we don't currently ever ship with DCHECKs compiled in, but disabled. ...
6 years, 10 months ago (2014-02-15 06:32:57 UTC) #8
asvitkine_google
Seems you're right - I must have remembered wrong. (Interestingly, this is different than NOTREACHED(), ...
6 years, 10 months ago (2014-02-15 14:56:53 UTC) #9
asvitkine_google
6 years, 10 months ago (2014-02-15 15:00:26 UTC) #10
On Sat, Feb 15, 2014 at 9:56 AM, Alexei Svitkine <asvitkine@google.com>wrote:

> Interestingly, this is different than NOTREACHED(), which I saw my canary
> hit and spew some output.
>

(Sorry, I meant NOTIMPLEMENTED() in that case. Not sure about NOTREACHED().)

To unsubscribe from this group and stop receiving emails from it, send an email
to chromium-reviews+unsubscribe@chromium.org.

Powered by Google App Engine
This is Rietveld 408576698