3 ms·
If the code paths are identical (failure and success) what is it optimising out exactly? JITs can create separate versions of a function for different inputs.
by nitrogen 12y ago
If the code paths are identical (failure and success) what is it optimising out exactly?
JITs can create separate versions of a function for different inputs. A good JIT can turn one general case function into multiple optimized special cases using techniques that include eliminating pseudoconstants (variables that always have the same or a small number of values) and skipping computation of never-referenced results. Even normal compilers can do a lot of that.
- yohanatan 12y agoI think a succinct way to put it is: on-the-fly "profile-guided optimization". A good JITter will do this automatically (as you said).