wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes Calling methods affects performance.... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Calling methods affects performance...." Watch "Calling methods affects performance...." New topic
Author

Calling methods affects performance....

senthil nathan
Greenhorn

Joined: Jun 14, 2002
Posts: 17
Hi,
I have a screen where i will give one input field, based on this field i'll populate 10 fields.In this 10 fields most of them involve calculations.I'll have method where i'll query the database for that input field.When i get the value, say i'm getting one value, again i should query another table for this fields(Which i got from preevious query) adn then calculate it and set it in a bean.My question is calling a method from another method often causes performance hindrance or not..
Thx in Adv
Senthil
Jason Ford
Ranch Hand

Joined: Aug 02, 2001
Posts: 54
My question is calling a method from another method often causes performance hindrance or not..

If I'm reading this question correctly, you're asking if there is a performance hit associated with calling one method from another. First, calling one method from another is essential to all but the simplest programs. I doubt you'll be able to do anything useful without it. Second, there may be a significant performance hit, depending on the definitions of the methods. For instance, if the calling method calls another method from within a big for loop, you might see the performance drop.
With that said, you cannot begin to worry about performance until you have set service levels (i.e. this method must complete in 2 ms.) I recommend you write the code first, and if you find it isn't fast enough, refactor it.
HTH,
Jason


SCJP, SCWCD
 
wood burning stoves
 
subject: Calling methods affects performance....