2 ms·
This has been tried several times and it just doesn't look like it works in practice. Delay slots, Itanium, etc. The CPU is a bit like a JIT in that it can see
by chrisseaton 9y ago
This has been tried several times and it just doesn't look like it works in practice. Delay slots, Itanium, etc.
The CPU is a bit like a JIT in that it can see how the program is really running and optimise for those conditions, which the AOT compiler cannot. Your AOT compiler may not know you're going to take a branch more times than not, but your CPU may be able to work that out at runtime. And then tomorrow you may never take the same branch and it'll work that out as well for the same code.
- std_throwaway 9y agoThe compiler only knows about the program and maybe statistical information about the data. The CPU knows about the actual data currently being processed. Therefore, the CPU can do more by using branch prediction and speculative execution. It is more expensive in terms of energy per computation but so far it was worth it. The CPU can also optimize old code on-the-fly.