[cfe-dev] -Wunreachable-code and templates
kremenek at apple.com
Tue Jan 10 07:55:36 PST 2012
On Jan 10, 2012, at 12:20 AM, David Blaikie wrote:
>> By repeatedly, you mean in each translation unit, right? Because we
>> shouldn't have to visit them more than once per TU (we won't be
>> visiting them per insntantiation). But, yes, the idea of analyzing
>> every boost template someone includes when they're only using a subset
>> does sound a little costly - I might be interested to compare times,
>> Only analyzing instantiated templates (& keeping a list of those
>> templates we've already seen/analyzed) seems OK to me, assuming that
>> didn't represent a prohibitive memory cost to maintain the set of
>> visited templates (can't see why it should, but it is a small
>> time/space tradeoff all the same).
> Is there a particular technique/suite/process I should use to try to
> measure the possible performance regression of performing reachable
> code analysis on all templates? (of course I may need to come up with
> my own test cases using the STL and/or boost to really grind things a
(1) My main concern is Boost and STL, which are commonly used. If you notice a significant performance regression on code that uses either, that's very concerning. What kind of performance loss are you seeing on your test cases?
(2) As a performance optimization, we could only analyzing uninstantiated templates that are actually instantiated. This means that some code won't get checked immediately, but doing otherwise doesn't seem to match the "pay-for-what-you-use" model of C++. That could recover some of the performance loss being observed in (1) to the point where things are acceptable.
Thanks again for working on this.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the cfe-dev