This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static final MethodHandle SET_ARRAY; | |
private static final MethodHandle GET_ARRAY; | |
static { | |
MethodHandle mh = null; | |
try { | |
final Method setArray = CopyOnWriteArrayList.class.getDeclaredMethod("setArray", Object[].class); | |
if (!setArray.isAccessible()) { | |
setArray.setAccessible(true); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package red.hat.puzzles.benchmarks; | |
import org.openjdk.jmh.annotations.*; | |
import org.openjdk.jmh.infra.Blackhole; | |
import java.util.HashMap; | |
import java.util.Map; | |
import java.util.concurrent.TimeUnit; | |
@State(Scope.Benchmark) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// class version 52.0 (52) | |
// access flags 0x21 | |
public class red/hat/puzzles/benchmarks/SwitchMapBench { | |
// compiled from: SwitchMapBench.java | |
@Lorg/openjdk/jmh/annotations/State;(value=Lorg/openjdk/jmh/annotations/Scope;.Benchmark) | |
@Lorg/openjdk/jmh/annotations/BenchmarkMode;(value={Lorg/openjdk/jmh/annotations/Mode;.AverageTime}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package red.hat.puzzles.benchmarks; | |
import org.openjdk.jmh.annotations.*; | |
import org.openjdk.jmh.infra.Blackhole; | |
import java.util.HashMap; | |
import java.util.Map; | |
import java.util.concurrent.TimeUnit; | |
@State(Scope.Benchmark) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package red.hat.puzzles.benchmarks; | |
import org.openjdk.jmh.annotations.*; | |
import org.openjdk.jmh.infra.Blackhole; | |
import org.openjdk.jmh.runner.Runner; | |
import org.openjdk.jmh.runner.RunnerException; | |
import org.openjdk.jmh.runner.options.Options; | |
import org.openjdk.jmh.runner.options.OptionsBuilder; | |
import java.util.HashMap; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private AtomicChunk<E> appendNextChunks(AtomicChunk<E> producerBuffer, long chunkIndex, int chunkSize, long chunks) | |
{ | |
assert chunkIndex != AtomicChunk.NIL_CHUNK_INDEX; | |
//prevent other concurrent attempts on appendNextChunk | |
if (!casProducerChunkIndex(chunkIndex, ROTATION)) | |
{ | |
return null; | |
} | |
AtomicChunk<E> newChunk = null; | |
for (long i = 1; i <= chunks; i++) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static final int SPIN = 10; | |
@Override | |
public E waitPoll(MessagePassingQueue<E> q) throws InterruptedException | |
{ | |
E e = null; | |
//use counted loop to reduce latencies saving safepoint polls | |
for (int i = 0; i < SPIN; i++) { | |
e = q.relaxedPoll(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class NonFinalHell { | |
private static final class SimpleString { | |
byte[] c = new byte[10]; | |
} | |
static SimpleString ss = new SimpleString(); | |
@CompilerControl(CompilerControl.Mode.DONT_INLINE) | |
public static int checkNull() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.openjdk.jmh.annotations.*; | |
import java.util.concurrent.TimeUnit; | |
@State(Scope.Benchmark) | |
@BenchmarkMode(Mode.AverageTime) | |
@OutputTimeUnit(TimeUnit.NANOSECONDS) | |
@Warmup(iterations = 5, time = 200, timeUnit = TimeUnit.MILLISECONDS) | |
@Measurement(iterations = 5, time = 200, timeUnit = TimeUnit.MILLISECONDS) | |
@Fork(1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.openjdk.jmh.annotations.*; | |
import java.util.ArrayList; | |
import java.util.HashMap; | |
import java.util.List; | |
import java.util.concurrent.TimeUnit; | |
@State(Scope.Benchmark) | |
@BenchmarkMode(Mode.AverageTime) | |
@OutputTimeUnit(TimeUnit.NANOSECONDS) |