Overall, I was disappointed by the session. Most of it was about the performance anti-patterns and i was expecting more about the static analysis tool. There was only one slide with an example of how to detect a pattern using static analysis and I found it hard to understand, It is easy to say to tell new developers not to do something. It is hard to detect programatically. Nevertheless, the points made are valid and here are the notes.
Is Java slow? Not on Intel for C at least.
What are root causes of performance issues?
- Bad architecture, code or design
- [or database/network and not java at all, but that’s out of scope here]
- Many ways to write incorrect code. Static analysis is not a replacement for traditional performance tuning
Types of analysis:
- Code query systems – Explore relationships among program elements, Codequest and jquery in this space
- Semantic code query systens – focus on behavior in addition to structure. Yonita is in this space. Yonita starts with bytecode to capture all detail. Then query in sql or prolog to find anti-patterns
- Note that yonita is a prototype and not yet publicly available
- JSF calling output text and the getXXX<> method makes a database call each time
- get value for key several time. Ok if took like Hibernate is caching it for you
- make the same ajax call twice and then do something different than the result
Fix by caching the value
Showed patterns for detecting, it looks complicated!
- Fine grained remote calls – entity beans versions 1 and 2
- One by one processing – adding one at a time instead of batching so the transaction, authorization and database all happen repeatedly
- Return a lot of records and discard the results
I asked if the static analysis tools could detect all of the anti-patterns shown. The answer was that it is library specific. I didn’t get a clear yes or no as to whether one could write a rule.
Someone asked about complex configurations. The answer was the tools struggle with dynamic configuration like Spring and specific support of the tool is required.