Thank you all for the helpful comments!
The main concern seems to be about whether the path accessor should stay inline or move out of line. The secondary concern is about the impact on naming. The biggest cost in the whole operation is the burden put on reviewers of the cascade of CLs because of renaming.
Inline vs. out-of-line
The 2 reasons for moving the accessor out of line are:
- [style] it now does a DCHECK in addition to producing the value, and
- [compilation time] it requires #include "base/logging.h" in the place of its definition (which is header if inline and .cc if out-of-line).
The current impact on compilation time seems negligible (*).
Style-wise, opinions differ on whether a simple accessor + DCHECK is still good to inline. Sample two arguments:
- Pro-inline: performance is only important in user builds, and DCHECKs are not present there.
- Against-inline: Growing the method will invite more growing without moving out-of-line in the future.
The code (//base) OWNER suggested moving this out of line, and I found that reasonable, so that's what I went with.
Naming
It is a prevalent pattern in Chrome that hacker_case() methods are inline and CamelCase() are out of line. The naming seems to be dictated here by consistency. So I am weighing the impact on consistency to the reviewers' work on the cascade of CLs.
Cost
The reviewers of the cascade of CLs have to verify two things:
- (1) That all the places with path() replaced by GetPath() compile and are properly formatted.
- (2) That all the changes to tests to fix use of uninitialised ScopedTempDir are OK.
Note that (2) would be also needed without renaming, and (1) is checked by compilators and ensured by clang-format. And I make sure to highlight (2) in the reviews and point out the mechanical nature of (1). Keeping the style consistency should therefore be a reasonable gain for the lowered cost.
Cheers,
Vaclav
(*) Full details of the simple measurement: On my Z620+goma, I did three runs of a clean complete release build with DCHECKs enabled: out-of-line, inline and out-of-line again. The timings I got for out-of-line were:
real 8m36.621s, 4m36.506s
user 21m25.947s, 22m6.458s
sys 7m20.215s, 7m39.631s
For inline I got
real 5m5.172s
user 22m10.033s
sys 7m34.140s
IIUC, the important one is "user". While out-of-line performs slightly better in both instances, the difference between the two out-of-line runs is bigger than between inline and out-of-line, so the inline vs. out-of-line difference is likely statistically unimportant.