[clang] [Clang][Lexer][Performance] Optimize Lexer whitespace skipping logic (PR #180819)

Thibault Monnier via cfe-commits cfe-commits at lists.llvm.org
Sat Feb 14 07:14:59 PST 2026


Thibault-Monnier wrote:

I tried 805b053f8003709679122a1bf639534f0defb70e, but it ended up worse for a full compilation.

> My testing says regardless of specific text layout, there is a point where the proportion of non-space characters in the whitespace changes the relative performance meaningfully. In my testing on an m2 laptop at around that 2.7% +/- 0.3 of the white space is not space characters the the early return in the PR falls behind the simply condition

How much behind? And how did you add non-space whitespaces? If they are predictable, (e.g. using tabs for indentation), I suspect the impact will be smaller.

https://github.com/llvm/llvm-project/pull/180819


More information about the cfe-commits mailing list