< prev index next > test/micro/org/openjdk/bench/java/lang/foreign/pointers/PointerBench.java
Print this page
@BenchmarkMode(Mode.AverageTime)
@Warmup(iterations = 3, time = 500, timeUnit = TimeUnit.MILLISECONDS)
@Measurement(iterations = 10, time = 500, timeUnit = TimeUnit.MILLISECONDS)
@OutputTimeUnit(TimeUnit.MILLISECONDS)
! @Fork(value = 3, jvmArgsAppend = "--enable-preview")
@State(Scope.Benchmark)
public class PointerBench {
final Arena arena = Arena.ofConfined();
static final int ELEM_SIZE = 1_000_000;
@BenchmarkMode(Mode.AverageTime)
@Warmup(iterations = 3, time = 500, timeUnit = TimeUnit.MILLISECONDS)
@Measurement(iterations = 10, time = 500, timeUnit = TimeUnit.MILLISECONDS)
@OutputTimeUnit(TimeUnit.MILLISECONDS)
! @Fork(3)
@State(Scope.Benchmark)
public class PointerBench {
final Arena arena = Arena.ofConfined();
static final int ELEM_SIZE = 1_000_000;
MemorySegment intSegment = intPointer.segment();
MemorySegment intPointerSegment = intPointerPointer.segment();
MemorySegment pointSegment = pointPointer.segment();
public static final AddressLayout UNSAFE_ADDRESS = ValueLayout.ADDRESS
! .withTargetLayout(MemoryLayout.sequenceLayout(ValueLayout.JAVA_BYTE));
@Setup
public void setup() {
for (int i = 0 ; i < ELEM_SIZE ; i++) {
intSegment.setAtIndex(ValueLayout.JAVA_INT, i, i);
MemorySegment intSegment = intPointer.segment();
MemorySegment intPointerSegment = intPointerPointer.segment();
MemorySegment pointSegment = pointPointer.segment();
public static final AddressLayout UNSAFE_ADDRESS = ValueLayout.ADDRESS
! .withTargetLayout(MemoryLayout.sequenceLayout(Long.MAX_VALUE, ValueLayout.JAVA_BYTE));
@Setup
public void setup() {
for (int i = 0 ; i < ELEM_SIZE ; i++) {
intSegment.setAtIndex(ValueLayout.JAVA_INT, i, i);
< prev index next >