简体   繁体   English

从硬件细节比较 python 性能

[英]Comparing python performance from hardware specifics

I am running some simulations in Python on my laptop, for my master degree project, and recently discovered that my desktop computer has almost the same performance of my laptop, when performing the same exact code.我在笔记本电脑上运行 Python 中的一些模拟,用于我的硕士学位项目,最近发现我的台式电脑在执行相同的确切代码时具有与笔记本电脑几乎相同的性能。 The problem is that my laptop has an i7 processor, while the desktop computer an i3.问题是我的笔记本电脑有 i7 处理器,而台式电脑有 i3。 More specifically:进一步来说:

Laptop: i7-5500U @2.40 GHz (64bit, dual core)笔记本电脑:i7-5500U @2.40 GHz(64 位,双核)

Desktop: i3-4150 @3.50 GHz (32bit, one core)台式机:i3-4150 @3.50 GHz(32 位,一核)

I am not an expert on computer science, neither I study it, and this is quite surprising to me.我不是计算机科学专家,我也不研究它,这让我很惊讶。 I know that the number of cores should not affect the performance, since python only uses one, but does it really all rely on clock frequency?我知道核心的数量应该不会影响性能,因为python只用了一个,但真的都依赖时钟频率吗? And if yes, what are the advantages of having an i7 with such clock frequency?如果是的话,拥有具有这种时钟频率的 i7 有什么好处? Is there some other data I am missing?我还缺少其他一些数据吗? What data one has to take under consideration to forecast computer's performance?预测计算机性能需要考虑哪些数据?

There are really too many factors in determining why your performance is like that.决定你的表现为什么会这样的因素实在太多了。 Consider:考虑:

  • Is your program memory-bound or calculation-bound?您的程序是受内存限制还是受计算限制?
  • Does your code really use multiple cores?你的代码真的使用多核吗?
  • Is your program slowed down by disk access?您的程序是否因磁盘访问而变慢?
  • Are you using different language versions or performance settings?您是否使用不同的语言版本或性能设置?

There are really many factors like these;确实有很多这样的因素; some of them are difficult to answer and impossible to guess.其中一些很难回答,也无法猜测。

You could try profiling this if important enough.如果足够重要,您可以尝试对此进行分析。

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

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