for the official oracle view, see: https://www.oracle.com/technical-resources/articles/java/arc...
"JMH provides a [snip] foundation for writing and running benchmarks whose results are not erroneous due to unwanted virtual machine optimizations"
unsolicited personal opinion: they're almost always erroneous for other reasons
i'm not sure which optimizations are currently disabled