当前位置: 首页>>代码示例>>Java>>正文


Java CompilerControl类代码示例

本文整理汇总了Java中org.openjdk.jmh.annotations.CompilerControl的典型用法代码示例。如果您正苦于以下问题:Java CompilerControl类的具体用法?Java CompilerControl怎么用?Java CompilerControl使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


CompilerControl类属于org.openjdk.jmh.annotations包,在下文中一共展示了CompilerControl类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: Unrolled

import org.openjdk.jmh.annotations.CompilerControl; //导入依赖的package包/类
@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;
}
 
开发者ID:richardstartin,项目名称:simdbenchmarks,代码行数:22,代码来源:HashCode.java

示例2: PopCount_Unrolled4

import org.openjdk.jmh.annotations.CompilerControl; //导入依赖的package包/类
@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;
}
 
开发者ID:richardstartin,项目名称:simdbenchmarks,代码行数:19,代码来源:PopCount.java

示例3: PopCount_Unrolled8

import org.openjdk.jmh.annotations.CompilerControl; //导入依赖的package包/类
@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;
}
 
开发者ID:richardstartin,项目名称:simdbenchmarks,代码行数:23,代码来源:PopCount.java

示例4: hashLoopSplit

import org.openjdk.jmh.annotations.CompilerControl; //导入依赖的package包/类
@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;
}
 
开发者ID:pnowojski,项目名称:simd-blog,代码行数:19,代码来源:BenchmarkSIMDBlog.java

示例5: pushWithoutJit

import org.openjdk.jmh.annotations.CompilerControl; //导入依赖的package包/类
@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();
}
 
开发者ID:jzillmann,项目名称:gradle-jmh-report,代码行数:18,代码来源:PullPushBenchmark.java

示例6: generateImport

import org.openjdk.jmh.annotations.CompilerControl; //导入依赖的package包/类
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();
}
 
开发者ID:msteindorfer,项目名称:jmh,代码行数:19,代码来源:BenchmarkGenerator.java

示例7: Mismatch_Handwritten

import org.openjdk.jmh.annotations.CompilerControl; //导入依赖的package包/类
@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);
}
 
开发者ID:richardstartin,项目名称:simdbenchmarks,代码行数:16,代码来源:ByteArrayMismatch.java

示例8: impl

import org.openjdk.jmh.annotations.CompilerControl; //导入依赖的package包/类
@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;
}
 
开发者ID:richardstartin,项目名称:simdbenchmarks,代码行数:9,代码来源:PrefixSum.java

示例9: BranchyCopyAndMask

import org.openjdk.jmh.annotations.CompilerControl; //导入依赖的package包/类
@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;
}
 
开发者ID:richardstartin,项目名称:simdbenchmarks,代码行数:14,代码来源:PositiveValues.java

示例10: BranchyNewArray

import org.openjdk.jmh.annotations.CompilerControl; //导入依赖的package包/类
@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;
}
 
开发者ID:richardstartin,项目名称:simdbenchmarks,代码行数:11,代码来源:PositiveValues.java

示例11: NewArray

import org.openjdk.jmh.annotations.CompilerControl; //导入依赖的package包/类
@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;
}
 
开发者ID:richardstartin,项目名称:simdbenchmarks,代码行数:11,代码来源:PositiveValues.java

示例12: CopyAndMask

import org.openjdk.jmh.annotations.CompilerControl; //导入依赖的package包/类
@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;
}
 
开发者ID:richardstartin,项目名称:simdbenchmarks,代码行数:12,代码来源:PositiveValues.java

示例13: Add_Doubles

import org.openjdk.jmh.annotations.CompilerControl; //导入依赖的package包/类
@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);
}
 
开发者ID:richardstartin,项目名称:simdbenchmarks,代码行数:12,代码来源:Addition.java

示例14: Add_Floats

import org.openjdk.jmh.annotations.CompilerControl; //导入依赖的package包/类
@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);
}
 
开发者ID:richardstartin,项目名称:simdbenchmarks,代码行数:12,代码来源:Addition.java

示例15: Add_Ints

import org.openjdk.jmh.annotations.CompilerControl; //导入依赖的package包/类
@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);
}
 
开发者ID:richardstartin,项目名称:simdbenchmarks,代码行数:12,代码来源:Addition.java


注:本文中的org.openjdk.jmh.annotations.CompilerControl类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。