Skip to main content

All Questions

Tagged with
0 votes
0 answers
115 views

UseSuperWord turned off, and still getting vectorized code?

I am benchmarking some algorithms, wondering how much the JIT applies auto-vectorization. I set up a JMH project and am trying to turn auto-vectorization off. The code snipped and the results can be ...
Styp's user avatar
  • 271
4 votes
1 answer
197 views

Why does running multiple lambdas in loops suddenly slow down?

Consider the following code: public class Playground { private static final int MAX = 100_000_000; public static void main(String... args) { execute(() -> {}); execute(() -...
Jakes's user avatar
  • 71
3 votes
1 answer
231 views

JMH - why JIT does not eliminate my dead-code

I wrote two benchmarks to demonstrate that JIT can be a problem with writing fine benchmark (Please skip that I doesnt use @State here): @Fork(value = 1) @Warmup(iterations = 2, time = 10) @...
ByeBye's user avatar
  • 6,878
13 votes
2 answers
2k views

Is it possible to make java.lang.invoke.MethodHandle as fast as direct invokation?

I'm comparing performance of MethodHandle::invoke and direct static method invokation. Here is the static method: public class IntSum { public static int sum(int a, int b){ return a + b; ...
St.Antario's user avatar
  • 27.1k
9 votes
1 answer
228 views

Comparing performance of Collectors.summingLong and Collectors.counting

Benchmarks are run under intel core i5, Ubuntu java version "1.8.0_144" Java(TM) SE Runtime Environment (build 1.8.0_144-b01) Java HotSpot(TM) 64-Bit Server VM (build 25.144-b01, mixed mode) I'm ...
St.Antario's user avatar
  • 27.1k
8 votes
1 answer
486 views

JVM JIT method recalculate for pure methods

Benchmarking the following Java code using jmh: interface MyInterface { public int test(int i); } class A implements MyInterface { public int test(int i) { return (int)Math.sin(Math....
Albert Netymk's user avatar
-1 votes
1 answer
119 views

How is this JMH microbenchmark skewed, if it is?

The benchmark is quite simple: @State(Scope.Benchmark) public class MathPowVsRawMultiplyTest { private static final double VICTIM; static { VICTIM = new Random(System....
fge's user avatar
  • 121k
1 vote
2 answers
769 views

Why use JMH if you can switch off JIT?

I wonder why I should use JMH for benchmarking if I can switch off JIT? Is JMH not suppressing optimizations which can be prevented by disabling JIT?
mmirwaldt's user avatar
  • 873