[clang] [lldb] [llvm] [mlir] [Support] Validate number of arguments passed to formatv() (PR #105745)

Rahul Joshi via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 28 12:06:17 PDT 2024


jurahul wrote:

I have uploaded a new version where the validation is enabled only in debug builds, and also added a benchmark for formatv(). On my machine, the benchmark results are as follows:

```
Old:
BM_FormatVariadic_mean      3427456 ns      3427426 ns           10

New
BM_FormatVariadic_mean      3360522 ns      3360236 ns           10

New with validation enabled in release builds:
BM_FormatVariadic_mean      3421434 ns      3421426 ns           10
```

So, the new mean is less than the old (with or without validation enabled). My takeaway is that the change in time is < measurement noise. In addition, since validation is now disabled in release builds, its relatively safe compile time perf wise.

I am currently running the CI with ENABLE_VALIDATION, buy @joker-eph can you start looking as well? Once the overall change is ok, I still need feedback around formatvv(). Given the new setup formatv(false, Fmt, ...) works, and since we just have 3 users of formatv() we could just switch to that and not invent a new name.

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


More information about the cfe-commits mailing list