Skip to content

Latest commit

 

History

History
69 lines (61 loc) · 1.91 KB

File metadata and controls

69 lines (61 loc) · 1.91 KB

Couple of measurements of object size in Java

Build:

./gradlew build

Run:

./gradlew run

Guides how to measure object size:

Mutable vs immutable collections in terms of size

Comparision between:

List with 100 000 items

List<Integer> Size in bytes
Integer[] 1997968
ArrayList 1997992
JImmutableTreeList 2064624
JImmutableLinkedStack 3997976
LinkedList 3997984
ConsPStack 4797984
TreePVector 5598048

Description

Set with 100 000 items

Set<Integer> Size in bytes
Integer[] 1997968
ArraySet 2398016
JImmutableTreeSet 5598032
TreeSet 5598032
HashSet 5846624
JImmutableHashSet 9246216
MapPSet 11198104

Description

Map with 100 000 items

Map<Integer, Integer> Size in bytes
Integer[] 1997968
SparseArrayCompat 2646576
ArrayMap 3186664
EclipseMutableMap 3695152
EclipseImmutableMap 3695168
TreeMap 5598000
JImmutableTreeMap 5598008
IntTreePMap 5598024
HashMap 5846608
GuavaImmutableMap 6495176
LinkedHashMap 6646600
JImmutableHashMap 9246200
HashPMap 11198088

Description