--- old/test/micro/org/openjdk/bench/java/math/BigIntegers.java 2019-12-10 17:10:30.249015366 -0800 +++ new/test/micro/org/openjdk/bench/java/math/BigIntegers.java 2019-12-10 17:10:30.101015366 -0800 @@ -137,4 +137,38 @@ } bh.consume(tmp); } + + /** Invokes the shiftLeft method of BigInteger with different values. */ + @Benchmark + @OperationsPerInvocation(TESTSIZE) + public void testLeftShift(Blackhole bh) { + Random rand = new Random(); + int shift = rand.nextInt(30) + 1; + BigInteger tmp = null; + for (BigInteger s : hugeArray) { + if (tmp == null) { + tmp = s; + continue; + } + tmp = tmp.shiftLeft(shift); + } + bh.consume(tmp); + } + + /** Invokes the shiftRight method of BigInteger with different values. */ + @Benchmark + @OperationsPerInvocation(TESTSIZE) + public void testRightShift(Blackhole bh) { + Random rand = new Random(); + int shift = rand.nextInt(30) + 1; + BigInteger tmp = null; + for (BigInteger s : hugeArray) { + if (tmp == null) { + tmp = s; + continue; + } + tmp = tmp.shiftRight(shift); + } + bh.consume(tmp); + } }