Reordering and Interleaving of Code
Are reordering and interleaving interchangeable开发者_开发问答 terms when it comes to code compilation, optimization and execution?
I'd say they describe a similar technique but mean something else at the detail level.
Reordering means to take random instructions and move them around for some reason. It's pretty generic.
Interleaving means to have two long pieces of code which access different hardware resources and which can therefore run in parallel. Weaving the instructions in a clever pattern can result in better execution times.
in case you are referring to out-of-order execution, this is something done at runtime by the processor depending on the availability of execution units and the instructions to be issued, while what Aaron described above would be at compile time (or even development time, if the code is complex (pointer aliasing comes to mind) or the compiler is not too good).
精彩评论