It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened,
visit the help center。
6年前关闭。
程序(C / C ++)的典型性能瓶颈是什么?
我编写了一些程序,其中涉及很多计算,但是,我发现通过将计算从
double
更改为
single
浮点运算,很少发现(即使有的话)性能得到很大改善,即使我使用了代码中包含许多
SIMD
指令,并且程序逐块而不是一对一地处理数据。
通过将数据从双倍更改为单个,
SIMD
单元可以处理两倍的计算单元,并且即使不加倍,就可以传输的变量而言,内存带宽也有所改善。
但是,性能差异几乎无法识别(大约5%)。
可能的原因是什么?那是不是因为计算(
sandy bridge
)在某种程度上受指令限制,因为每个周期内CPU只能发出有限数量的指令?