Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8286452

The array length of testSmallConstArray should be small and const

XMLWordPrintable

    • gc
    • b23

        test/micro/org/openjdk/bench/vm/gc/Alloc.java

         38 public class Alloc {
         39
         40 public static final int LENGTH = 400;
         41 public static final int ARR_LEN = 100;
         42 public int largeLen = 100;
         43 public int smalllen = 6;
        ...
         54 @Benchmark
         55 public void testLargeVariableArray(Blackhole bh) throws Exception {
         56 int localArrlen = largeLen;
         57 for (int i = 0; i < LENGTH; i++) {
         58 Object[] tmp = new Object[localArrlen];
         59 bh.consume(tmp);
         60 }
         61 }
         62
         63 @Benchmark
         64 public void testSmallConstArray(Blackhole bh) throws Exception {
         65 int localArrlen = largeLen;
         66 for (int i = 0; i < LENGTH; i++) {
         67 Object[] tmp = new Object[localArrlen];
         68 bh.consume(tmp);
         69 }
         70 }

        testLargeVariableArray and testSmallConstArray are the same, the localArrlen of testSmallConstArray should be small and const.

              wanghaomin Haomin Wang
              wanghaomin Haomin Wang
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: