简体   繁体   English

如何设置该编译器标志?

[英]How to set that compiler flag?

Shark told me this: 鲨鱼告诉我:

This instruction is the start of a loop that is not aligned to a 16-byte address boundary. 该指令是未与16字节地址边界对齐的循环的开始。 For optimal performance, you should align the start of a hot loop using a compiler directive. 为了获得最佳性能,应使用编译器指令对齐热循环的开始。 With gcc 3.3 or later, use the -falign-loops=16 compiler flag. 对于gcc 3.3或更高版本,请使用-falign-loops = 16编译器标志。

for (int i=0; i < 4; i++) { // line with the info
   //...code
}

How would I set that flag, and does it really improve performance? 我将如何设置该标志,它真的会提高性能吗?

The hints from Shark are not always appropriate. Shark的提示并不总是合适的。 Aligning loops doesn't make a lot of difference in most cases. 在大多数情况下,对齐循环并没有多大区别。 Focus on the bottlenecks in your code and see what you can do at the algo/code level before resorting to very minor tweaks such as this. 着眼于代码中的瓶颈,并在进行诸如此类的细微调整之前,先在算法/代码级别查看可以做什么。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM