Skip to content

Instantly share code, notes, and snippets.

@rjdkolb
Last active December 30, 2015 01:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rjdkolb/7754974 to your computer and use it in GitHub Desktop.
Save rjdkolb/7754974 to your computer and use it in GitHub Desktop.
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