代码的重新排序和交错
在代码编译、优化和执行方面,重新排序和交错可以互换吗?
Are reordering and interleaving interchangeable terms when it comes to code compilation, optimization and execution?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我想说他们描述了类似的技术,但在细节层面上有其他含义。
重新排序意味着采用随机指令并出于某种原因移动它们。这是非常通用的。
交错意味着有两段长代码可以访问不同的硬件资源,因此可以并行运行。以巧妙的模式编织指令可以缩短执行时间。
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).