Reimplement the matching logic using Visitors instead of matchers.
Benchmarks from running the check over SemaCodeComplete.cpp
Before 0.20s, After 0.04s
Paths
| Differential D125026
[clang-tidy][NFC] Reimplement SimplifyBooleanExpr with RecursiveASTVisitors ClosedPublic Authored by njames93 on May 5 2022, 10:53 AM.
Details Summary Reimplement the matching logic using Visitors instead of matchers. Benchmarks from running the check over SemaCodeComplete.cpp
Diff Detail
Event TimelineComment Actions Remove unnecessary tests in ReadabilityTidyModule now that the SimplifyBooleanExprMatchers header has been removed. njames93 retitled this revision from [clang-tidy][NFC] Reimplement most of SimplifyBooleanExpr with RecursiveASTVisitors to [clang-tidy][NFC] Reimplement SimplifyBooleanExpr with RecursiveASTVisitors.May 9 2022, 5:57 AM This revision is now accepted and ready to land.May 16 2022, 5:26 AM Comment Actions So those times were a little unfair as now we don't use ParentMapContext, however the cost of building that is included in the running time for the check. Closed by commit rG6f8726191960: [clang-tidy][NFC] Reimplement SimplifyBooleanExpr with RecursiveASTVisitors (authored by njames93). · Explain WhyMay 16 2022, 6:42 AM This revision was automatically updated to reflect the committed changes. Comment Actions Just for my own edification, how did you know/suspect that a pure visitor would be faster than matchers? Comment Actions
Mainly cause the fact we are creating 2 matcher expressions that differ by a bool value for each pattern, a visitor can easily handle both cases in one go.
Revision Contents
Diff 429701 clang-tools-extra/clang-tidy/readability/SimplifyBooleanExprCheck.h
clang-tools-extra/clang-tidy/readability/SimplifyBooleanExprCheck.cpp
clang-tools-extra/clang-tidy/readability/SimplifyBooleanExprMatchers.h
clang-tools-extra/unittests/clang-tidy/ReadabilityModuleTest.cpp
|