CPU 我知道我运行的程序所用的内存没有超过机器的内存大小,因为我用htop看过, 硬盘上的swap空间确实是没有被动用过。但是由于程序用的数据量比较大, 做过分析的人告诉我说实际上CPU在很大的时间内是在等待和内存交换数据, 所以升级CPU对于性能的提升有限。 CPU 我找到了一些分析的程序,像perf,glances。不过看了得仔细的看说明来学一下这些 工具 怎么用.
【在 u**n 的大作中提到】 : On linux, you may run oprofile to profile your program to understand time : consumed by your functions. : Also see this: : https://www.akkadia.org/drepper/cpumemory.pdf
u*n
15 楼
Then you may revisit your algorithm and data structure, make it cache friendly. There are also prefetch instructions which might help hide memory access latency.