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 _______________________________________________ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel