I herad that object allocation will reduce the performance of java application.Could you say how much and how it is happening if i creates a lot of objects eg a substring operation or a string concatenation using + operator ------------------
I just want to know is there any body call my bean's Getter and Setter methods with "Please" in front - My favorite quip from Bugzilla
Originally posted by Anoop Krishnan: I herad that object allocation will reduce the performance of java application.
A couple of days ago there was a question from someone having a performance problem which he thought was caused by his database. After retrieving 1000 or so records, execution speed took a nosedive. Looking at the code, there were a few dozen string concatenations for each record! After replacing this with a StringBuffer, total execution time went down from over an hour to a couple of minutes. Object allocation isn't so bad, but the subsequent garbage collection has a huge performance impact. That's why, in the anecdote above, performance was OK until all available memory had been used up and execution speed became constrained by how fast the garbage collector could free up memory. It's a fact of life in Java that you tend to create fairly large amounts of short-lived objects, and generational garbage collectors in today's JVMs try to make the best of it. Still, if you are careless, performance will suffer badly. - Peter