When profiling Maki I noticed that findAlignedASTNodesForExpansion was taking up a significant amount of the runtime of Maki, specifically with each call to MatchFinder::matchAST.
Clang supports adding multiple matchers to a MatchFinder to allow finding different matches over a single pass of the AST, so optimize matchNodes to accept multiple matchers.
Make matchNodes take a variadic amount of matchers and fold call to MatchFinder::addMatcher.
Assign Expansion->ASTRoots and Arg.AlignedRoots the result of matchNodes, which will use move assignment.
On analyzing bash-5.2 this brought down the CPU time from 2741s to 2401s.
When profiling Maki I noticed that
findAlignedASTNodesForExpansion
was taking up a significant amount of the runtime of Maki, specifically with each call toMatchFinder::matchAST
.Clang supports adding multiple matchers to a MatchFinder to allow finding different matches over a single pass of the AST, so optimize
matchNodes
to accept multiple matchers.matchNodes
take a variadic amount of matchers and fold call toMatchFinder::addMatcher
. AssignExpansion->ASTRoots
andArg.AlignedRoots
the result ofmatchNodes
, which will use move assignment.On analyzing bash-5.2 this brought down the CPU time from 2741s to 2401s.