aspose file tools
The moose likes Java in General and the fly likes any resource or performance (memory or cpu) issue does this code present ? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "any resource or performance (memory or cpu) issue does this code present ?" Watch "any resource or performance (memory or cpu) issue does this code present ?" New topic
Author

any resource or performance (memory or cpu) issue does this code present ?

Raj Ohadi
Ranch Hand

Joined: Jun 30, 2006
Posts: 314
If I have a code like



When N is big number, the code keeps looping for N times. My question is --- when program loops for N times, does it eat lot of memory or what ? what kind resource problem it may cause when N is big ? what kind of performance problem it may cause (ignore the time that it takes toloop, that's not an issue) ?
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336


when program loops for N times, does it eat lot of memory or what ?

This is the sort of question that is best answered empirically. What did you observe when you ran it?


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 32689
    
    4
It probably doesn't require a lot of memory; the many numbers can all fit into one int space, which is updated every iteration.
I suggest you change it to read
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: any resource or performance (memory or cpu) issue does this code present ?
 
Similar Threads
Help with simple Recursive functions
Returning the last line in a file.
Garbage collection?
Stock Overflow Error
Counting uppercase? Part 2!