Skip to content

Instantly share code, notes, and snippets.

@ersiner
Created September 18, 2013 19:20
Show Gist options
  • Save ersiner/6614165 to your computer and use it in GitHub Desktop.
Save ersiner/6614165 to your computer and use it in GitHub Desktop.
// Test Code
int[] pArray = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
measurePrint("int Array", pArray);
Integer[] oArray = new Integer[10];
for (int i = 0; i < 10; i++)
{
oArray[i] = new Integer(i + 1);
}
measurePrint("Integer Array", oArray);
List oList = new ArrayList(10);
for (int i : pArray)
{
oList.add(new Integer(i));
}
measurePrint("Integer List", oList);
TIntArrayList pList = new TIntArrayList(10);
for (int i : pArray)
{
pList.add(i);
}
measurePrint("int List", pList);
// Output
// int Array: 56
// Footprint{Objects=1, References=0, Primitives=[int x 10]}
// Integer Array: 216
// Footprint{Objects=11, References=10, Primitives=[int x 10]}
// Integer List: 240
// Footprint{Objects=12, References=11, Primitives=[int x 12]}
// int List: 80
// Footprint{Objects=2, References=1, Primitives=[int x 12]}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment