Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Test and Performance Tools Platform (TPTP) » Different variations of a rule without killing perf?
Different variations of a rule without killing perf? [message #61144] Tue, 28 March 2006 10:31 Go to previous message
Eclipse User
Originally posted by: stuart.a.ballard.gmail.com

I'm writing static analysis rules which, if all goes according to plan,
will be run against a very large codebase, so performance is important. To
make matters worse, my rules pretty much require looking at the body of
every method (at least, I haven't yet found a filter that will allow me to
efficiently trim the set of methods to be looked at).

Furthermore, each of the overall rules that I want to write has about
three different variations which should be able to be enabled or disabled
independently. I can, of course, write entirely separate rules for each
variation, but that would involve running a chunk of common code once for
each variation - which triples the performance problem mentioned in the
first paragraph.

What I'd ideally like to be able to do is write code like:

foreach (MethodDeclaration meth in methods) {
if (methodMeetsFirstCriterion(meth)) {
if (variation1Enabled() && variation1(meth)) {
reportResult(meth, "First criterion, variation 1");
} else if (variation2Enabled() && variation2(meth)) {
reportResult(meth, "First criterion, variation 2");
} else if (variation3Enabled() && variation3(meth)) {
reportResult(meth, "First criterion, variation 3");
}
}
if (methodMeetsSecondCriterion(meth)) {
...
}
}

Is there a way to do something in a performant way that will produce
results equivalent to this, assuming that the methodMeetsNthCriterion()
and variationN() are nontrivial amounts of code?

(They're not *tremendously* complicated, but I also imagine that looping
over every method in a large codebase has a pretty significant overhead of
its own, in which case I'd rather only pay that once than three times per
criterion. Feel free to correct me if my assumptions are faulty and it's
really cheap to do that)
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic:Widget Resolver problem
Next Topic:AGR standard execution stalls
Goto Forum:
  


Current Time: Mon May 20 15:44:30 EDT 2013

Powered by FUDForum. Page generated in 0.04527 seconds