Java Performance - ArrayLists versus Arrays for lots of fast reads -


I have a program where I need to make random access to 100,000 to 1,000,000 such as the inventory object less time Is read in a cellular automata-such as possible for a program (as in milliseconds) I think the update algorithm I am using is already optimized (keeps track of active cells efficiently, etc.). The list needs to be changed, but this performance is not as important as it is, I am thinking that the difference in the timeline is read in such a short time, if there is a difference in the use of the array instead of the Ariel, Does not fall. Currently, I am using array list.

EDIT: I forgot to say: I am just storing the integer, so another aspect is using the integer cover class (in the case of Arrestist) vs INS (in case of Arrays ) Does anyone know that to use ArrayList will actually need 3 indicator lookup (for an ArrayList, for an underlying array, and for an integer-> int) where the array is only 1 (array Need address + offset Fraction)? Will hotspot optimize additional look ups? Edit 2: Besides, I also forgot that I need to write random access (write, not entry). Now you have mentioned that your arrays are actually of antiquity, collection-in-the-file in the library, Consider using primitive-type classes. / P>

@Witching Important (tenfold!) Speed ​​up report using comments in your application - see comments. Flip-side is that the Trove archive types are not compatible with Java's standard archive API. So the traction (or similar library) will not answer in all the cases.


Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -