< prev index next >

test/micro/org/openjdk/bench/jdk/incubator/vector/MemorySegmentVectorAccess.java

Print this page

 33 import jdk.incubator.vector.VectorSpecies;
 34 import org.openjdk.jmh.annotations.Benchmark;
 35 import org.openjdk.jmh.annotations.BenchmarkMode;
 36 import org.openjdk.jmh.annotations.CompilerControl;
 37 import org.openjdk.jmh.annotations.Fork;
 38 import org.openjdk.jmh.annotations.Measurement;
 39 import org.openjdk.jmh.annotations.Mode;
 40 import org.openjdk.jmh.annotations.OutputTimeUnit;
 41 import org.openjdk.jmh.annotations.Param;
 42 import org.openjdk.jmh.annotations.Setup;
 43 import org.openjdk.jmh.annotations.State;
 44 import org.openjdk.jmh.annotations.Warmup;
 45 
 46 @BenchmarkMode(Mode.AverageTime)
 47 @Warmup(iterations = 5, time = 500, timeUnit = TimeUnit.MILLISECONDS)
 48 @Measurement(iterations = 10, time = 500, timeUnit = TimeUnit.MILLISECONDS)
 49 @State(org.openjdk.jmh.annotations.Scope.Thread)
 50 @OutputTimeUnit(TimeUnit.NANOSECONDS)
 51 @Fork(value = 1, jvmArgsAppend = {
 52     "--add-modules=jdk.incubator.vector",
 53     "--enable-preview",
 54     "--enable-native-access", "ALL-UNNAMED"})
 55 public class MemorySegmentVectorAccess {
 56   private static final VectorSpecies<Byte> SPECIES = VectorSpecies.ofLargestShape(byte.class);
 57 
 58   @Param("1024")
 59   private int size;
 60 
 61   byte[] byteIn;
 62   byte[] byteOut;
 63 
 64   MemorySegment nativeIn, nativeOut;
 65   MemorySegment heapIn, heapOut;
 66 
 67   MemorySegment nativeInRo, nativeOutRo;
 68   MemorySegment heapInRo, heapOutRo;
 69 
 70   @Setup
 71   public void setup() {
 72       Arena scope1 = Arena.ofAuto();
 73       nativeIn = scope1.allocate(size, 1);

 33 import jdk.incubator.vector.VectorSpecies;
 34 import org.openjdk.jmh.annotations.Benchmark;
 35 import org.openjdk.jmh.annotations.BenchmarkMode;
 36 import org.openjdk.jmh.annotations.CompilerControl;
 37 import org.openjdk.jmh.annotations.Fork;
 38 import org.openjdk.jmh.annotations.Measurement;
 39 import org.openjdk.jmh.annotations.Mode;
 40 import org.openjdk.jmh.annotations.OutputTimeUnit;
 41 import org.openjdk.jmh.annotations.Param;
 42 import org.openjdk.jmh.annotations.Setup;
 43 import org.openjdk.jmh.annotations.State;
 44 import org.openjdk.jmh.annotations.Warmup;
 45 
 46 @BenchmarkMode(Mode.AverageTime)
 47 @Warmup(iterations = 5, time = 500, timeUnit = TimeUnit.MILLISECONDS)
 48 @Measurement(iterations = 10, time = 500, timeUnit = TimeUnit.MILLISECONDS)
 49 @State(org.openjdk.jmh.annotations.Scope.Thread)
 50 @OutputTimeUnit(TimeUnit.NANOSECONDS)
 51 @Fork(value = 1, jvmArgsAppend = {
 52     "--add-modules=jdk.incubator.vector",

 53     "--enable-native-access", "ALL-UNNAMED"})
 54 public class MemorySegmentVectorAccess {
 55   private static final VectorSpecies<Byte> SPECIES = VectorSpecies.ofLargestShape(byte.class);
 56 
 57   @Param("1024")
 58   private int size;
 59 
 60   byte[] byteIn;
 61   byte[] byteOut;
 62 
 63   MemorySegment nativeIn, nativeOut;
 64   MemorySegment heapIn, heapOut;
 65 
 66   MemorySegment nativeInRo, nativeOutRo;
 67   MemorySegment heapInRo, heapOutRo;
 68 
 69   @Setup
 70   public void setup() {
 71       Arena scope1 = Arena.ofAuto();
 72       nativeIn = scope1.allocate(size, 1);
< prev index next >