aspose file tools*
The moose likes Performance and the fly likes Is there a performace impact for those ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Performance
Bookmark "Is there a performace impact for those ?" Watch "Is there a performace impact for those ?" New topic
Author

Is there a performace impact for those ?

Costa lamona
Ranch Hand

Joined: Sep 24, 2006
Posts: 102
continue
break
return

Is there a performance bad effect for those keywords?


SCJP 5
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10091
    
164

Each of these are used for different functionalities. I dont see a way how these statements would affect the performance in any way. Any reason why you are trying to figure out the performance impact of these 3 control statements?


[My Blog] [JavaRanch Journal]
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8895
    
    8

The use of break and continue is frowned upon more because it makes for confusing code than for any performance issues.
You can't avoid using return. Every method has to return some time or another. There is also a rule of thumb that one should not return anywhere but the end of the method because it is difficult to find return statements buried in code and can confuse readers.


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18564
    
    8

When you talk about performance impacts, you must always be comparing two options. You can't say something is "better" without saying what it is better than.

Now, for example, what are you comparing "return" to? Not returning? The other thing you must always consider when comparing the performance of two options is that the two options must be doing the same thing. Otherwise your comparison is worthless.
steve souza
Ranch Hand

Joined: Jun 26, 2002
Posts: 861
In any real application this would not be a bottleneck, and so you will find most developers won't know much about the performance characteristics of the keywords you mention. Even if there was a difference it likely would be different between VM's, and versions of the jdk.


http://www.jamonapi.com/ - a fast, free open source performance tuning api.
JavaRanch Performance FAQ
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Is there a performace impact for those ?