-
Notifications
You must be signed in to change notification settings - Fork 0
Optimizing compiler is too clever #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hmmm... inventing it on my own is a little bit too complicated.
The compiler might be clever enough to figure out that
But we want to measure only this:
I'm afraid this can't be solved even by JMH. |
Experiment with JMH could be very nice for the project. |
Do you have multiple bricks to experiment? |
Hi, no, I have only one education set and it's borrowed from FEE CTU. Jakub |
If you could get another one by Science purposes, we could experiment with RMI to synchronise java processes located in different JVMs. Good night Juan Antonio |
Hi,
I've tried using
System.nanoTime
and I still get negative durations on my machine (OpenJDK 64-Bit Server VM (build 25.151-b12, mixed mode
):The compiler (source → bytecode or bytecode → x86) must be somehow reordering the program flow.
The same thing happens on the brick with OpenJDK 9, with the exception that it's in the float benchmark.
Well, I know of two possible solutions. One is to try to isolate benchmarks to their own functions and somehow limit the optimizer, the second is to use Java Microbenchmark Harness - I've read on StackOverflow that it is the recommended way of running tests like this.
Jakub Vaněk
The text was updated successfully, but these errors were encountered: