Skip to content

Instantly share code, notes, and snippets.

View jsound's full-sized avatar

Andreas Mueller jsound

  • MGM technology partners
  • Munich, Germany
View GitHub Profile
@jsound
jsound / MixedRandomListRealWorld_GarbageProducer
Created April 10, 2014 04:26
GC benchmark similar to MixedRandomList but with CPU usage < 100% and with reasonable GC rate
package de.am.gc.benchmarks;
import java.util.ArrayList;
import java.util.List;
/**
* GC benchmark producing a mix of lifetime=0 and lifetime>0 objects which are kept in randomly updated lists.
* It is very similar to MixedRandomList: https://gist.github.com/jsound/8096954#file-mixedrandomlist_garbageproducer
* but with two changes to make it more real-world:
* 1. CPU usage is reduced by adding some latency using Thread.sleep()
@jsound
jsound / GarbageOnly_GarbageProducer
Created December 23, 2013 13:38
A simple GC micro benchmark that creates only objects of 0 lifetime (but as many of them as possible)
package de.am.gc.benchmarks;
/**
* A GC micro benchmark running a given number of threads that create objects of a given size and dereference them immediately
*
* @author jsound
*/
public class GarbageOnly {
// object size in bytes
private static final int DEFAULT_NUMBEROFTHREADS=8;
@jsound
jsound / MixedRandomList_GarbageProducer
Created December 23, 2013 13:13
GC benchmark producing a mix of lifetime=0 and lifetime>0 objects which are kept in randomly updated lists
package de.am.gc.benchmarks;
import java.util.ArrayList;
import java.util.List;
/**
* GC benchmark producing a mix of lifetime=0 and lifetime>0 objects which are kept in randomly updated lists.
*
* @author jsound
*/