[PATCH] Refactor Matcher<T> and DynTypedMatcher to reduce overhead of casts.

Samuel Benzaquen sbenza at google.com
Wed Sep 24 13:53:59 PDT 2014


Hi klimek,

This change introduces DynMatcherInterface and changes the internal
representation of DynTypedMatcher and Matcher<T> to use a generic
interface instead.
It removes unnecessary indirections and virtual function calls when
converting matchers by implicit and dynamic casts.
DynTypedMatcher now remembers the stricter type in the chain of casts
and checks it before calling into DynMatcherInterface.
This change improves our clang-tidy related benchmark by ~14%.
Also, it opens the door for more optimizations of this kind that are
coming in future changes.

As a side effect of removing these template instantiations, it also
speeds up compilation of Dynamic/Registry.cpp by ~17% and reduces the number of
symbols generated by ~30%.

http://reviews.llvm.org/D5485

Files:
  include/clang/AST/ASTTypeTraits.h
  include/clang/ASTMatchers/ASTMatchersInternal.h
  lib/ASTMatchers/ASTMatchersInternal.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D5485.14051.patch
Type: text/x-patch
Size: 25676 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140924/52a4bcb9/attachment.bin>


More information about the cfe-commits mailing list