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

Oliver Hunt via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 13 18:52:06 PST 2026


ojhunt wrote:

Rather than per site branches, it might be better to just remove the table lookup if we can. I recognize that there might well be other characters that set these flags for historical reasons, but I'd be interested in see the ideal perf of something like this:

```cpp
bool isHorizontalWhitespace(char Ch) {
  return Ch == ' ' || Ch == '\t' || Ch == '\f' || Ch == '\v';
}
```

It should compile down to something pretty much branchless on most modern targets

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


More information about the cfe-commits mailing list