wood burning stoves 2.0*
The moose likes Performance and the fly likes Looking for a tool/plugin to display a method calling structure Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Performance
Bookmark "Looking for a tool/plugin to display a method calling structure" Watch "Looking for a tool/plugin to display a method calling structure" New topic
Author

Looking for a tool/plugin to display a method calling structure

Michael Schumacher
Greenhorn

Joined: May 08, 2008
Posts: 5
I'm trying to determine what parts of an application that I can have performance improved by determining if a method is being called within a for loop that could be moved outside of the for loop, or any code that is retrieving a row from the database and later on does the same call again.

Is there such a beast that will do this?

Thanks, Michael
Winston Gutkowski
Bartender

Joined: Mar 17, 2011
Posts: 8043
    
  22

Michael Schumacher wrote:Is there such a beast that will do this?

Yes: the human eye/brain - especially if attached to a programmer.

There are probably automated code checkers that can check for duplication, or even path analysers that can determine some forms of redundancy; but they're likely to be simplistic. And I'd be very surprised if they could help you out with database redundancy.

This also smacks of "shutting the stable door after the horse has gone". The correct way to go about this is not to do it in the first place: An ounce of prevention is worth a pound of cure.

If this is for legacy code, I fear the only way to be sure you've caught all your "redundancies" is to initiate a proper refactoring process; and that will involve puny humans. I certainly wouldn't rely on any automated 'checker' to do the job for me.

Winston


Isn't it funny how there's always time and money enough to do it WRONG?
Articles by Winston can be found here
Michael Schumacher
Greenhorn

Joined: May 08, 2008
Posts: 5
The issue is that the depth/complexity of the code - yes a tool isn't going to handle the complexity of the code, but a tool that could show the call structure of methods could reveal a method getting called at the start of the level then down 5 calls, it could get called again, when it shouldn't get called since at level 1, it already had that information. This is where having a tool to show this would help clean up code legacy code.
Winston Gutkowski
Bartender

Joined: Mar 17, 2011
Posts: 8043
    
  22

Michael Schumacher wrote:The issue is that the depth/complexity of the code - yes a tool isn't going to handle the complexity of the code, but a tool that could show the call structure of methods could reveal a method getting called at the start of the level then down 5 calls, it could get called again, when it shouldn't get called since at level 1, it already had that information. This is where having a tool to show this would help clean up code legacy code.

Well, like I say, I'm sure there are some around; you may even get more specific help here. But whatever tool you do get is still likely to need a fair bit of human interaction; and I definitely wouldn't rely on it to discover ALL such problems.

'Fraid there's no real avoiding the BSwAT (blood sweat and tears) for something like this that I know of - ie, a major (and properly spec'ed and budgeted) project.

Winston
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Looking for a tool/plugin to display a method calling structure