D943: chg: move only first time relevant if condition out of loop
quark (Jun Wu)
phabricator at mercurial-scm.org
Thu Oct 5 15:12:31 EDT 2017
quark added a comment.
I think the general rule of extracting one-time condition to outside a loop is correct. But the `i == 0` check may be subject to change - if we do want to support `hg -R ... serve` for example, `i == 0` may be changed to `iscmdname` or something. And this diff would make that change harder. Maybe we can change `i == 0` to `iscmdname` now and leave some TODO notes about `iscmdname` to clarify the intention and current defect.
Performance-wise I'd expect compiler to do smart things. Unfortunately it seems gcc and clang are not that smart as of today.
REPOSITORY
rHG Mercurial
REVISION DETAIL
https://phab.mercurial-scm.org/D943
To: singhsrb, #hg-reviewers, yuja
Cc: yuja, quark, mercurial-devel
More information about the Mercurial-devel
mailing list