3 ms·
All this is only worsened by the ‘black box’ nature of the optimization level switches. Doesn't the JIT do all sorts of crazy stuff that's not always reproduci
by jgalt212 13y ago
All this is only worsened by the ‘black box’ nature of the optimization level switches.
Doesn't the JIT do all sorts of crazy stuff that's not always reproducible and thus hard to profile? I know this is the case with V8, but probably also so with Java. I don't know much about compilers, but the author seems to know even less.
- brianpgordon 13y agoThe author appears to be laboring under the assumption that enabling GCC or Clang optimizations can cause failures in programs, in contrast to Java where the guarantees are rock solid. Of course, this is not true- in both Java and C++ the compiler's optimizations are strictly standard-compliant (at reasonable O levels in GCC) and in both if you rely on undefined behavior then optimizations can break your application. His problem isn't with unreliable optimizers, it's with writing bug-free code. And yes, HotSpot can do tons of stuff, from eliminating virtual method calls, to inlining methods, to deciding whether a wait should be busy or not. And it does become a serious pain to profile, especially when you have code paths which are infrequently hit and so might not be JITed.
- pkolaczk 13y agoSure, but the number of ways to (accidentally) rely on UB in C++ is order of magnitude higher than in Java.