Page 1 of 1

Java performance and scalability

Posted: December 1st, 2004, 6:59 pm
by European81
What are your guys views on Java's performance and scalability? When I work with very large arrays (20000x1000) of data it sometimes grinds to a halt and wont even finish. Is this Java specific or what? Maybe the problem is that I try to draw all data to the screen. 10000x1000 is fine though. It isn't that this is a huge problem but I am just trying to get a feeling for where the limits are. Also, is there a performance penalty of creating say 1000 object that contain only two int values each and then adding them to an arraylist versus having a 2x1000 array with the values?

Java performance and scalability

Posted: December 1st, 2004, 9:45 pm
by rleeuk
Is that an array of doubles? a 20000x1000 array of doubles will cost you 160MB of ram! the java VM uses only 64M ram by default.How much memory do you have on your system? If the answer is <= 256MB you will probably need to do some optimisation so you don't have to hold such a large array in memory, otherwise try running it with the -Xmx parameter (e.g. -Xmx256M tells the VM to use 256M, see "java -X")> Also, is there a performance penalty of creating say 1000 object that contain only two int values each and then adding them to an arraylist versus having a 2x1000 array with the values?Yes there will be a performance hit when using arraylist, but to hold 1000 object the penalty should be pretty small, so by all means use it if you want to have the extra flexibilities. The use of object instead of primitive types is another overhead, but I would expect the impact to be small if the class just has 2 integer fields.

Java performance and scalability

Posted: December 2nd, 2004, 7:56 am
by DominicConnor
Exactly how are you allocating the objects ?If you're allocating any freeing dynamically 20 M objects then you risk memory fragmentation.Which O/S and JVM are you using ?