[cfe-dev] Expression Templates for AST matchers

Manuel Klimek klimek at google.com
Thu Apr 9 12:55:46 PDT 2015


On Thu, Apr 9, 2015 at 10:22 AM Richard <legalize at xmission.com> wrote:

>
> In article <CAOsfVvmev4Y7Q=Wr=8RJQFs49S94J0OE97-iJyaWRZVvCD60Jg at mail.
> gmail.com>,
>     Manuel Klimek <klimek at google.com> writes:
>
> > We actually went from a more expression templatey to a less expression
> > templatey design.
>
> Interesting!  So far, I feel like what I've been trying to match is
> completely expressable at compile-time and deferring things to runtime
> is making things slow.  This seems to be consistent with the findings
> of the imlpementors of OCLint and why they make the statement I quoted
> earlier.
>
> > On Tue, Apr 7, 2015, 3:31 PM Sean Silva <chisophugis at gmail.com> wrote:
> >
> > > Although I'm mostly an armchair spectator right now w.r.t. clang
> tooling
> > > stuff, I think that use cases like clang-query and in general the
> dynamic
> > > AST matchers suggests that expression templates aren't a very good
> solution
> > > because they will require reimplementing things from scratch for the
> > > "dynamic" case.
>
> When I look at a library like Boost.Spirit that heavily uses
> expression templates I don't see how I'm losing the dynamic case at
> all.  Maybe I'm misunderstanding what you're saying.
>
> > Sam has worked on making clang tidy use cases faster. I
> > expect in the end the right thing is to do less duplicate work which I
> > think we will be able to do with modules.
>
> While modules are nice, I don't think it's reasonable to expect that
> modules will be deployed over a significant chunk of the world's C++
> code anytime soon.  So it doesn't seem practical to say "modules will
> fix this".
>

Well, it's a matter of prioritization.
1. expression templates will make the code significantly more complex and
harder to maintain
2. we need benchmark results to show that they'll actually get something
3. we need to have enough engineering resources for the future to maintain
the library

If you're willing to spend the time to prove that expression templates
actually help real world benchmarks here without too much complexity, and
if you can convince the current maintainers of the library that there will
be enough hands on deck to support the implementation going forward, I'm
happy to review patches :) (I'd say you mainly have to convince Sam, who
has done most of the core changes lately)

Other than that it's a priorities game.


>
> > > Regardless, I don't think that the primary bottleneck is not doing
> enough
> > > at compile time (of the matchers). Rather we aren't effectively
> indexing
> > > the underlying data set we are trying to query (right now, we're more
> like
> > > grep and less like google). [...] (a
> > > good example is using a trigram index to prune the search space for
> regexp
> > > matching http://swtch.com/~rsc/regexp/regexp4.html).
> > >
> > > * "multiple" here also scales numerically with the number of TU's. An
> > > index can avoid visiting certain TU's at all in many cases.
>
> Thanks for that link Sean, that was an interesting read.  I couldn't
> find it "live" on the web, but was able to get it via the wayback
> machine on archive.org.
> --
> "The Direct3D Graphics Pipeline" free book <http://tinyurl.com/d3d-
> pipeline>
>      The Computer Graphics Museum <http://ComputerGraphicsMuseum.org>
>          The Terminals Wiki <http://terminals.classiccmp.org>
>   Legalize Adulthood! (my blog) <http://LegalizeAdulthood.wordpress.com>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20150409/0613e342/attachment.html>


More information about the cfe-dev mailing list