< prev index next >

test/micro/org/openjdk/bench/jdk/incubator/foreign/LoopOverNew.java

Print this page
*** 42,11 ***
  import java.nio.ByteBuffer;
  import java.nio.ByteOrder;
  import java.util.concurrent.TimeUnit;
  
  import static jdk.incubator.foreign.MemoryLayout.PathElement.sequenceElement;
! import static jdk.incubator.foreign.MemoryLayouts.JAVA_INT;
  
  @BenchmarkMode(Mode.AverageTime)
  @Warmup(iterations = 5, time = 500, timeUnit = TimeUnit.MILLISECONDS)
  @Measurement(iterations = 10, time = 500, timeUnit = TimeUnit.MILLISECONDS)
  @State(org.openjdk.jmh.annotations.Scope.Thread)
--- 42,11 ---
  import java.nio.ByteBuffer;
  import java.nio.ByteOrder;
  import java.util.concurrent.TimeUnit;
  
  import static jdk.incubator.foreign.MemoryLayout.PathElement.sequenceElement;
! import static jdk.incubator.foreign.ValueLayout.JAVA_INT;
  
  @BenchmarkMode(Mode.AverageTime)
  @Warmup(iterations = 5, time = 500, timeUnit = TimeUnit.MILLISECONDS)
  @Measurement(iterations = 10, time = 500, timeUnit = TimeUnit.MILLISECONDS)
  @State(org.openjdk.jmh.annotations.Scope.Thread)

*** 59,14 ***
      static final int ELEM_SIZE = 1_000_000;
      static final int CARRIER_SIZE = (int)JAVA_INT.byteSize();
      static final int ALLOC_SIZE = ELEM_SIZE * CARRIER_SIZE;
      static final MemoryLayout ALLOC_LAYOUT = MemoryLayout.sequenceLayout(ELEM_SIZE, JAVA_INT);
  
!     static final VarHandle VH_int = MemoryLayout.sequenceLayout(JAVA_INT).varHandle(int.class, sequenceElement());
  
      final ResourceScope scope = ResourceScope.newConfinedScope();
!     final SegmentAllocator recyclingAlloc = SegmentAllocator.ofSegment(MemorySegment.allocateNative(ALLOC_LAYOUT, scope));
  
      @TearDown
      public void tearDown() throws Throwable {
          scope.close();
      }
--- 59,14 ---
      static final int ELEM_SIZE = 1_000_000;
      static final int CARRIER_SIZE = (int)JAVA_INT.byteSize();
      static final int ALLOC_SIZE = ELEM_SIZE * CARRIER_SIZE;
      static final MemoryLayout ALLOC_LAYOUT = MemoryLayout.sequenceLayout(ELEM_SIZE, JAVA_INT);
  
!     static final VarHandle VH_int = MemoryLayout.sequenceLayout(JAVA_INT).varHandle(sequenceElement());
  
      final ResourceScope scope = ResourceScope.newConfinedScope();
!     final SegmentAllocator recyclingAlloc = SegmentAllocator.prefixAllocator(MemorySegment.allocateNative(ALLOC_LAYOUT, scope));
  
      @TearDown
      public void tearDown() throws Throwable {
          scope.close();
      }
< prev index next >