简体   繁体   English

Scala等与C / C ++ / Fortran之间的性能比较?

[英]Comparison of performance between Scala etc. and C/C++/Fortran?

I wonder if there is any reliable comparison of performance between "modern" multithreading-specialized languages like eg scala and "classic" "lower-level" languages like C, C++, Fortran using parallel libs like MPI, Posix or even Open-MP. 我想知道在“现代”多线程专用语言(例如scala)和“经典”“低级”语言(如C,C ++,Fortran)之间是否有可靠的性能比较,使用MPI,Posix甚至Open-MP等并行库。

Any links and suggestions welcome. 任何链接和建议欢迎。

Given that Java, and, therefore, Scala, can call external libraries, and given that those highly specialized external libraries will do most of the work, then the performance is the same as long as the same libraries are used. 鉴于Java,以及Scala,可以调用外部库,并且考虑到那些高度专业化的外部库将完成大部分工作,那么只要使用相同的库,性能就是相同的。

Other than that, any such comparison is essentially meaningless. 除此之外,任何这样的比较基本上都是毫无意义的。 Scala code runs on a virtual machine which has run-time optimization. Scala代码在具有运行时优化的虚拟机上运行。 That optimization can push long-running programs towards greater performance than programs compiled with those other languages -- or not. 这种优化可以推动长期运行的程序比使用其他语言编译的程序更好的性能 - 或者不是。 It depends on the specific program written in each language. 这取决于用每种语言编写的特定程序。

Here's another non-answer: go to your local supercomputer centre and ask what fraction of the CPU load is used by each language you are interested in. This will only give you a proxy answer to your question, it will tell you what the people who are concerned with high performance on such machines use when tackling the kind of problem that they tackle. 这是另一个非答案:转到您当地的超级计算机中心,询问您感兴趣的每种语言使用的CPU负载的比例。这只会给您一个代理问题的答案,它会告诉您哪些人是谁关注这类机器在解决他们所处理的问题时的高性能。 But it's as instructive as any other answer you are likely to get for such a broad question. 但是,对于这样一个广泛的问题,你可能得到的任何其他答案都具有指导性。

PS The answer will be that Fortran, C and C++ consume well in excess of 95% of the CPU cycles. PS答案是Fortran,C和C ++消耗的CPU周期超过95%。

I'd view such comparisons as a fraction. 我认为这种比较只是一个分数。 The numerator is a constant (around 0.00001, I believe). 分子是一个常数(我相信大约0.00001)。 The denominator is the number of threads multiplied by the number of logical processors. 分母是线程数乘以逻辑处理器的数量。

IOW, for a single thread, the comparison has about a one chance in a million of meaning something. IOW,对于一个单独的线程,这个比较在一百万个含义中有一个机会。 For a quad core processor running an application with (say) 16 threads, you're down to one chance in 64 million of a meaningful result. 对于运行具有(例如)16个线程的应用程序的四核处理器,在6400万有意义的结果中,你只有一次机会。

In short, there are undoubtedly quite a few people working on it, but the chances of even a single result from any of them providing a result that's useful and meaningful is still extremely low. 简而言之,毫无疑问,有很多人在研究它,但是即使是任何一个提供有用且有意义的结果的单一结果的可能性仍然非常低。 Worse, even if one of them really did mean something, it would be almost impossible to find, and even more difficult to verify to the point that you actually knew it meant something. 更糟糕的是,即使其中一个确实有意义,也几乎不可能找到,甚至更难以验证到你实际上知道它意味着什么。

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

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