[PATCH] D137258: [clang] Optimize storage and lookup of analyzer options

Jan Svoboda via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 2 10:57:15 PST 2022


jansvoboda11 planned changes to this revision.
jansvoboda11 added a comment.

In D137258#3947181 <https://reviews.llvm.org/D137258#3947181>, @steakhal wrote:

> Are you sure about the speedup?
> When I looked at the implementation of the `StringSwitch`, it boiled down to an `if-else` chain under the hood.

You're right. I assumed `StringSwitch` was more sophisticated than that. This patch provides speedup for my use-case, which involves constructing lots of `AnalyzerOptions` instances, but no calls to `AnalyzerOptions::isUnknownAnalyzerConfig()`. I'll spend more time on this and make sure I don't regress the lookup. (Unfortunately, `std::sort` is only `constexpr` in C++20 onwards, so I can't just sort the options at compile-time.)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D137258/new/

https://reviews.llvm.org/D137258



More information about the cfe-commits mailing list