owenca wrote:

> While it is less code, I find a bit harder to understand and the code gen is 
> far worse: https://gcc.godbolt.org/z/KzG4YnTh3

`IsBlank` is misleading because of `std::isblank` whereas `Blanks.contains` is 
not, so the latter has better readability for me. As to the generated code, the 
latter is worse in runtime (IMO negligible in practice), but the code size is 
about the same with `-O2` and far better with `-Os` (again, negligible in 
practice). See [this](https://gcc.godbolt.org/z/YsaKa4hP7) modified example, 
which adds a call to the local function `IsBlank` to make the comparison fairer.

More importantly, we wouldn't need to update `IsBlank` if `Blanks` changes. 
This happened at least once (580da276161ee) before.

https://github.com/llvm/llvm-project/pull/146245
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to