|
|
|
|
|
by lazide
412 days ago
|
|
I think it has shaken out the way it has, is because compile time optimizations to this extent require knowing runtime constraints/data at compile time. Which for non-trivial situations is impossible, as the code will be run with too many different types of input data, with too many different cache sizes, etc. The CPU has better visibility into the actual runtime situation, so can do runtime optimization better. In some ways, it’s like a bytecode/JVM type situation. |
|
For the trivial example of 2+2 like above, of course, this is a moot discussion. The commenter should've lead with a better example.