appleseedlab / maki

A tool for analyzing syntactic and semantic properties of C Preprocessor macros in C programs
8 stars 3 forks source link

Optimize finding aligned AST nodes to match on single AST pass #66

Closed SilverMight closed 1 month ago

SilverMight commented 1 month ago

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.

On analyzing bash-5.2 this brought down the CPU time from 2741s to 2401s.