문제

I am interested in understanding important Java coding rules from the performance point of view. Also, if someone has already tried putting these rules in a static code analyzer like Sonar for static code inspection.
Please pour in your views or any suggestions.
Regards,
Xhings

도움이 되었습니까?

해결책 2

Performance is dynamic characteristic, so it is difficult to spot it in static analysis. You never know regarding the performance. The general observation in the industry is '80% of CPU is consumed by 20% of code'. Very frequently it is even more imbalanced than that. And it is almost impossible to predict the location of this 20% spot in advance. Sometimes it is even difficult to find it using dynamic analysis (due to lack of right profiling test-scenarios, which are close to real production scenarios). However, Intel Amplifier XE in light-weight hotspots mode can (usually) profile real production deployments. Worth trying.

다른 팁

Findbug, is the bug detection tool used in Sonar. It has category for performance. You could create ruleset just including only the performance ones. For example

SBSC: Method concatenates strings using + in a loop

Side note : Static code analysis will be of limited help to identify bottleneck. You will have to use real performance analysis tools (like VisualVM, JProfiler or YourKit ) for identifying areas of improvements.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top