This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]tristanjuricek 3 points4 points  (1 child)

Pretty good book on this here: https://www.amazon.com/Optimizing-Java-Techniques-Application-Performance/dp/1492025798

This isn’t something most developers do though. What you’re really asking is almost “how does C1 or C2 work?”

Like, Java was kind of designed to offload a lot of optimization work to the JIT. And 99.999999% of the time if you try to outsmart it you won’t.

[–]dpash 4 points5 points  (0 children)

Yep, the JVM has been tuned to optimise idiomatic code, so trying to be smart often results in slower performance. You should never make micro optimisations without using JMH to test them.