4 ms·
I ran the 3 visualizations at the end of the article and made imgur albums: Images are in order. JOLSample_22_Compaction: http://imgur.com/a/agJaR http://imgu
by BenoitP 9y ago
I ran the 3 visualizations at the end of the article and made imgur albums:
Images are in order.
JOLSample_22_Compaction: http://imgur.com/a/agJaR http://imgur.com/a/agJaR
JOLSample_23_Defragmentation: http://imgur.com/a/A74k9 http://imgur.com/a/A74k9
JOLSample_24_Colocation: http://imgur.com/a/RTrhL http://imgur.com/a/RTrhL
In JOLSample_22_Compaction, Aleksey writes: "It happens because many temporary objects are allocated while populating the list.". I'm having trouble knowing exactly what are the temporary objects. Is it the implicit c.toString()? Maybe also the "int minCapacity" in ensureCapacityInternal in ArrayList[1]? Is there more?
Also, in JOLSample_22_Compaction it is kind of nice to see some gaps spaced by growing powers of 2 in http://imgur.com/4T5dBi8 http://imgur.com/4T5dBi8 ; it must be the actual pointer arrays of the ArrayList, replaced successively to grow in size. And the current one being in green color. Or am I mistaken?
Fascinating.
[1] http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/8u40-b25/java/util/ArrayList.java#222 http://grepcode.com/file/repository.grepcode.com/java/root/j...