Java 类org.openjdk.jmh.annotations.CompilerControl 实例源码

项目:simdbenchmarks    文件:HashCode.java   
@Benchmark
@CompilerControl(CompilerControl.Mode.DONT_INLINE)
public int Unrolled(HashCodeData state) {
    int[] a = state.data;
    if (a == null)
        return 0;

    int result = 1;
    int i = 0;
    for (; i + 3 < a.length; i += 4) {
        result = 31 * 31 * 31 * 31 * result
               + 31 * 31 * 31 * a[i]
               + 31 * 31 * a[i + 1]
               + 31 * a[i + 2]
               + a[i + 3];
    }
    for (; i < a.length; i++) {
        result = 31 * result + a[i];
    }
    return result;
}
项目:simdbenchmarks    文件:PopCount.java   
@Benchmark
@CompilerControl(CompilerControl.Mode.DONT_INLINE)
public long PopCount_Unrolled4(LongData state) {
    long popCnt = 0L;
    long[] data = state.data1;
    int i = 0;
    for (; i + 3 < data.length; i += 4) {
        popCnt = popCnt
               + Long.bitCount(data[i])
               + Long.bitCount(data[i + 1])
               + Long.bitCount(data[i + 2])
               + Long.bitCount(data[i + 3]);
    }
    for (; i < data.length; ++i) {
        popCnt += Long.bitCount(data[i]);
    }
    return popCnt;
}
项目:simdbenchmarks    文件:PopCount.java   
@Benchmark
@CompilerControl(CompilerControl.Mode.DONT_INLINE)
public long PopCount_Unrolled8(LongData state) {
    long popCnt = 0L;
    long[] data = state.data1;
    int i = 0;
    for (; i + 7 < data.length; i += 8) {
        popCnt = popCnt
                + Long.bitCount(data[i])
                + Long.bitCount(data[i + 1])
                + Long.bitCount(data[i + 2])
                + Long.bitCount(data[i + 3])
                + Long.bitCount(data[i + 4])
                + Long.bitCount(data[i + 5])
                + Long.bitCount(data[i + 6])
                + Long.bitCount(data[i + 7]);
    }
    for (; i < data.length; ++i) {
        popCnt += Long.bitCount(data[i]);
    }
    return popCnt;
}
项目:simd-blog    文件:BenchmarkSIMDBlog.java   
@Benchmark
@CompilerControl(CompilerControl.Mode.DONT_INLINE) //makes looking at assembly easier
public int[] hashLoopSplit(Context context)
{
    for (int i = 0; i < SIZE; i++) {
        context.results[i] = getHashPosition1(context.values[i]);
    }

    for (int i = 0; i < SIZE; i++) {
        context.results[i] = getHashPosition2(context.results[i]);
    }

    for (int i = 0; i < SIZE; i++) {
        context.results[i] = getHashPosition3(context.results[i], 1048575);
    }

    return context.results;
}
项目:gradle-jmh-report    文件:PullPushBenchmark.java   
@Benchmark
@CompilerControl(org.openjdk.jmh.annotations.CompilerControl.Mode.EXCLUDE)
public long pushWithoutJit() {
    Reader reader = new Reader(MAX, _nulls);
    PushConsumer consumer = new PushConsumer();
    for (int i = 0; i < reader.getMax(); i++) {
        boolean nextIsNull = reader.nextIsNull();
        if (nextIsNull) {
            consumer.consumeNull();
        } else {
            consumer.consume(reader.readNext());
        }
    }
    assertThat(consumer.getSum()).isEqualTo(4950000000000000L);
    assertThat(consumer.getNullCount()).isEqualTo(1000000);
    return consumer.getSum();
}
项目:jmh    文件:BenchmarkGenerator.java   
private void generateImport(PrintWriter writer) {
    Class<?>[] imports = new Class<?>[]{
            List.class, AtomicInteger.class,
            Collection.class, ArrayList.class,
            TimeUnit.class, Generated.class, CompilerControl.class,
            InfraControl.class, ThreadParams.class,
            Result.class, ThroughputResult.class, AverageTimeResult.class,
            SampleTimeResult.class, SingleShotResult.class, SampleBuffer.class,
            Mode.class, Fork.class, Measurement.class, Threads.class, Warmup.class,
            BenchmarkMode.class, RawResults.class, ResultRole.class,
            Field.class, BenchmarkParams.class, IterationParams.class
    };

    for (Class<?> c : imports) {
        writer.println("import " + c.getName() + ';');
    }
    writer.println();
}
项目:simdbenchmarks    文件:ByteArrayMismatch.java   
@Benchmark
@CompilerControl(CompilerControl.Mode.DONT_INLINE)
public void Mismatch_Handwritten(BytePrefixData data, Blackhole bh) {
    byte[] data1 = data.data1;
    byte[] data2 = data.data2;
    int length = Math.min(data1.length, data2.length);
    int mismatch = -1;
    for (int i = 0; i < length; ++i) {
        if (data1[i] != data2[i]) {
            mismatch = i;
            break;
        }
    }
    bh.consume(mismatch);
}
项目:simdbenchmarks    文件:PrefixSum.java   
@CompilerControl(CompilerControl.Mode.DONT_INLINE)
private int[] impl(int[] data) {
    int[] result = new int[data.length];
    for (int i = 1; i < result.length; ++i) {
        result[i] = result[i - 1] + data[i];
    }
    return result;
}
项目:simdbenchmarks    文件:PositiveValues.java   
@Benchmark
@CompilerControl(CompilerControl.Mode.DONT_INLINE)
public double[] BranchyCopyAndMask(ArrayWithNegatives state) {
    double[] data = state.data;
    double[] result = state.target;
    System.arraycopy(data, 0, result, 0, data.length);
    for (int i = 0; i < result.length; ++i) {
        if (result[i] < 0D) {
            result[i] = 0D;
        }
    }
    return result;
}
项目:simdbenchmarks    文件:PositiveValues.java   
@Benchmark
@CompilerControl(CompilerControl.Mode.DONT_INLINE)
public double[] BranchyNewArray(ArrayWithNegatives state) {
    double[] data = state.data;
    double[] result = state.target;
    for (int i = 0; i < result.length; ++i) {
        result[i] = data[i] < 0D ? 0D : data[i];
    }
    return result;
}
项目:simdbenchmarks    文件:PositiveValues.java   
@Benchmark
@CompilerControl(CompilerControl.Mode.DONT_INLINE)
public double[] NewArray(ArrayWithNegatives state) {
    double[] data = state.data;
    double[] result = state.target;
    for (int i = 0; i < result.length; ++i) {
        result[i] = Math.max(data[i], 0D);
    }
    return result;
}
项目:simdbenchmarks    文件:PositiveValues.java   
@Benchmark
@CompilerControl(CompilerControl.Mode.DONT_INLINE)
public double[] CopyAndMask(ArrayWithNegatives state) {
    double[] data = state.data;
    double[] result = state.target;
    System.arraycopy(data, 0, result, 0, data.length);
    for (int i = 0; i < result.length; ++i) {
        result[i] = Math.max(result[i], 0D);
    }
    return result;
}
项目:simdbenchmarks    文件:Addition.java   
@Benchmark
@CompilerControl(CompilerControl.Mode.DONT_INLINE)
public void Add_Doubles(DoubleData d, Blackhole bh) {
    double[] data1 = d.data1;
    double[] data2 = d.data2;
    double[] result = new double[data1.length];
    for (int i = 0; i < data1.length; ++i) {
        result[i] = data1[i] + data2[i];
    }
    bh.consume(result);
}
项目:simdbenchmarks    文件:Addition.java   
@Benchmark
@CompilerControl(CompilerControl.Mode.DONT_INLINE)
public void Add_Floats(FloatData d, Blackhole bh) {
    float[] data1 = d.data1;
    float[] data2 = d.data2;
    float[] result = new float[data1.length];
    for (int i = 0; i < data1.length; ++i) {
        result[i] = data1[i] + data2[i];
    }
    bh.consume(result);
}
项目:simdbenchmarks    文件:Addition.java   
@Benchmark
@CompilerControl(CompilerControl.Mode.DONT_INLINE)
public void Add_Ints(IntData d, Blackhole bh) {
    int[] data1 = d.data1;
    int[] data2 = d.data2;
    int[] result = new int[data1.length];
    for (int i = 0; i < data1.length; ++i) {
        result[i] = data1[i] + data2[i];
    }
    bh.consume(result);
}
项目:simdbenchmarks    文件:Addition.java   
@Benchmark
@CompilerControl(CompilerControl.Mode.DONT_INLINE)
public void Add_Longs(LongData d, Blackhole bh) {
    long[] data1 = d.data1;
    long[] data2 = d.data2;
    long[] result = new long[data1.length];
    for (int i = 0; i < data1.length; ++i) {
        result[i] = data1[i] + data2[i];
    }
    bh.consume(result);
}
项目:simdbenchmarks    文件:PopCount.java   
@Benchmark
@CompilerControl(CompilerControl.Mode.DONT_INLINE)
public long PopCount(LongData state) {
    long popCnt = 0L;
    long[] data = state.data1;
    for (int i = 0; i < data.length; ++i) {
        popCnt += Long.bitCount(data[i]);
    }
    return popCnt;
}
项目:simdbenchmarks    文件:PopCount.java   
@Benchmark
@CompilerControl(CompilerControl.Mode.DONT_INLINE)
public int PopCountInt(IntData state) {
    int popCnt = 0;
    int[] data = state.data1;
    for (int i = 0; i < data.length; ++i) {
        popCnt += Integer.bitCount(data[i]);
    }
    return popCnt;
}
项目:simdbenchmarks    文件:SumOfSquares.java   
@Benchmark
@CompilerControl(CompilerControl.Mode.DONT_INLINE)
public void SS_Doubles(DoubleData d, Blackhole bh) {
    double[] data = d.data1;
    double result = 0D;
    for (int i = 0; i < data.length; ++i) {
        result += data[i] * data[i];
    }
    bh.consume(result);
}
项目:simdbenchmarks    文件:SumOfSquares.java   
@Benchmark
@CompilerControl(CompilerControl.Mode.DONT_INLINE)
public void SS_Floats(FloatData d, Blackhole bh) {
    float[] data = d.data1;
    float result = 0F;
    for (int i = 0; i < data.length; ++i) {
        result += data[i] * data[i];
    }
    bh.consume(result);
}
项目:simdbenchmarks    文件:SumOfSquares.java   
@Benchmark
@CompilerControl(CompilerControl.Mode.DONT_INLINE)
public void SS_Ints(IntData d, Blackhole bh) {
    int[] data = d.data1;
    int result = 0;
    for (int i = 0; i < data.length; ++i) {
        result += data[i] * data[i];
    }
    bh.consume(result);
}
项目:simdbenchmarks    文件:SumOfSquares.java   
@Benchmark
@CompilerControl(CompilerControl.Mode.DONT_INLINE)
public void SS_Longs(LongData d, Blackhole bh) {
    long[] data = d.data1;
    long result = 0;
    for (int i = 0; i < data.length; ++i) {
        result += data[i] * data[i];
    }
    bh.consume(result);
}
项目:simdbenchmarks    文件:Scale.java   
@CompilerControl(CompilerControl.Mode.DONT_INLINE)
@Benchmark
public double Scale(DoubleData state) {
    double value = 0D;
    double[] data = state.data1;
    for (int i = 0; i < data.length; ++i) {
        value += 3.14159 * data[i];
    }
    return value;
}
项目:simdbenchmarks    文件:Scale.java   
@CompilerControl(CompilerControl.Mode.DONT_INLINE)
@Benchmark
public double FactoredScale(DoubleData state) {
    double value = 0D;
    double[] data = state.data1;
    for (int i = 0; i < data.length; ++i) {
        value += data[i];
    }
    return 3.14159 * value;
}
项目:simdbenchmarks    文件:Scale.java   
@CompilerControl(CompilerControl.Mode.DONT_INLINE)
@Benchmark
public int NaiveSum(IntData state) {
    int value = 0;
    int[] data = state.data1;
    for (int i = 0; i < data.length; ++i) {
        value += data[i];
    }
    return value;
}
项目:simdbenchmarks    文件:Scale.java   
@CompilerControl(CompilerControl.Mode.DONT_INLINE)
@Benchmark
public int CropCircle(IntData state) {
    int value = 0;
    int[] data = state.data1;
    for (int i = 0; i < data.length; ++i) {
        value += 2 * data[i];
    }
    return value / 2;
}
项目:simdbenchmarks    文件:Scale.java   
@CompilerControl(CompilerControl.Mode.DONT_INLINE)
@Benchmark
public int Scale_Int(IntData state) {
    int value = 0;
    int[] data = state.data1;
    for (int i = 0; i < data.length; ++i) {
        value += 10 * data[i];
    }
    return value;
}
项目:simdbenchmarks    文件:Scale.java   
@CompilerControl(CompilerControl.Mode.DONT_INLINE)
@Benchmark
public int FactoredScale_Int(IntData state) {
    int value = 0;
    int[] data = state.data1;
    for (int i = 0; i < data.length; ++i) {
        value += data[i];
    }
    return 10 * value;
}
项目:simdbenchmarks    文件:Scale.java   
@CompilerControl(CompilerControl.Mode.DONT_INLINE)
@Benchmark
public int Scale_Int_Dynamic(ScaleState state) {
    int value = 0;
    int[] data = state.data;
    int factor = state.randomFactor();
    for (int i = 0; i < data.length; ++i) {
        value += factor * data[i];
    }
    return value;
}
项目:simdbenchmarks    文件:Scale.java   
@CompilerControl(CompilerControl.Mode.DONT_INLINE)
@Benchmark
public int FactoredScale_Int_Dynamic(ScaleState state) {
    int value = 0;
    int[] data = state.data;
    int factor = state.randomFactor();
    for (int i = 0; i < data.length; ++i) {
        value += data[i];
    }
    return factor * value;
}
项目:mumu-benchmark    文件:JMHSample_32_BulkWarmup.java   
@CompilerControl(CompilerControl.Mode.DONT_INLINE)
public int measure(Counter c) {
    int s = 0;
    for (int i = 0; i < 10; i++) {
        s += c.inc();
    }
    return s;
}
项目:simd-blog    文件:BenchmarkSIMDBlog.java   
@Benchmark
@CompilerControl(CompilerControl.Mode.DONT_INLINE) //makes looking at assembly easier
public int[] increment(Context context)
{
    for (int i = 0; i < SIZE; i++) {
        context.results[i] = context.values[i] + 1;
    }
    return context.results;
}
项目:simd-blog    文件:BenchmarkSIMDBlog.java   
@Benchmark
@CompilerControl(CompilerControl.Mode.DONT_INLINE) //makes looking at assembly easier
public int[] hashLoop(Context context)
{
    for (int i = 0; i < SIZE; i++) {
        context.results[i] = getHashPosition(context.values[i], 1048575);
    }
    return context.results;
}
项目:simd-blog    文件:BenchmarkSIMDBlog.java   
@Benchmark
@CompilerControl(CompilerControl.Mode.DONT_INLINE) //makes looking at assembly easier
public void hashLoopPart(Context context)
{
    for (int i = 0; i < SIZE; i++) {
        context.results[i] = getHashPosition1(context.values[i]);
    }
}
项目:simd-blog    文件:BenchmarkSIMDLongBlog.java   
@Benchmark
@CompilerControl(CompilerControl.Mode.DONT_INLINE) //makes looking at assembly easier
public void increment(Context context)
{
    for (int i = 0; i < SIZE; i++) {
        context.temporary[i] = context.values[i] + 1;
    }
}
项目:simd-blog    文件:BenchmarkSIMDLongBlog.java   
@Benchmark
@CompilerControl(CompilerControl.Mode.DONT_INLINE) //makes looking at assembly easier
public void bitshift(Context context)
{
    for (int i = 0; i < SIZE; i++) {
        context.temporary[i] = context.values[i] / 2;
    }
}
项目:simd-blog    文件:BenchmarkSIMDLongBlog.java   
@Benchmark
@CompilerControl(CompilerControl.Mode.DONT_INLINE) //makes looking at assembly easier
public int[] hashLongLoop(Context context)
{
    for (int i = 0; i < SIZE; i++) {
        context.results[i] = getHashPosition(context.values[i], 1048575);
    }

    return context.results;
}
项目:simd-blog    文件:BenchmarkSIMDLongBlog.java   
@Benchmark
@CompilerControl(CompilerControl.Mode.DONT_INLINE) //makes looking at assembly easier
public int[] hashLongLoopSplit(Context context)
{
    for (int i = 0; i < SIZE; i++) {
        context.temporary[i] = getHashPositionMangle(context.values[i]);
    }
    for (int i = 0; i < SIZE; i++) {
        context.temporary[i] = getHashPositionMul1(context.values[i]);
    }
    for (int i = 0; i < SIZE; i++) {
        context.temporary[i] = getHashPositionMangle(context.values[i]);
    }
    for (int i = 0; i < SIZE; i++) {
        context.temporary[i] = getHashPositionMul2(context.values[i]);
    }
    for (int i = 0; i < SIZE; i++) {
        context.temporary[i] = getHashPositionMangle(context.values[i]);
    }
    for (int i = 0; i < SIZE; i++) {
        context.results[i] = getHashPositionCast(context.values[i]);
    }
    for (int i = 0; i < SIZE; i++) {
        context.results[i] = getHashPositionMask(context.results[i], 1048575);
    }

    return context.results;
}
项目:simd-blog    文件:BenchmarkSIMDLongBlog.java   
@Benchmark
@CompilerControl(CompilerControl.Mode.DONT_INLINE) //makes looking at assembly easier
public long[] hashLoopTwoInstructions(Context context)
{
    for (int i = 0; i < SIZE; i++) {
        context.temporary[i] = getHashPositionTwoInstructions(context.values[i]);
    }
    return context.temporary;
}
项目:org.ops4j.pax.transx    文件:PreparedStatementBench.java   
@Benchmark
@CompilerControl(CompilerControl.Mode.INLINE)
public Statement cycleStatement(Blackhole bh, ConnectionState state) throws SQLException
{
    PreparedStatement statement = state.connection.prepareStatement("INSERT INTO test (column) VALUES (?)");
    statement.setInt(1, 1);
    bh.consume(statement.executeUpdate());
    statement.close();
    return statement;
}