Skip to content

Instantly share code, notes, and snippets.

@rjdkolb
Last active Dec 30, 2015
Embed
What would you like to do?
Simple class to create thousands of classes and test the performance of JEP 149 - OpenJDK 8 against OpenJDK7
public class ConsumeHeap {
public static void main(String []args) throws IOException{
HashMap<Long,Integer> hugeMap = new HashMap<>();
Random rand = new Random(System.currentTimeMillis());
for (int count=0;count <5000000;count++){
long time = System.currentTimeMillis();
hugeMap.put(time, rand.nextInt());
}
System.out.println("Done");
System.gc();
System.in.read();
hugeMap.size();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment