单声道性能
与 GNU/Linux 中的 Java 相比,Mono 是否有任何性能基准?
你测试过Mono的性能吗?
Are there any performance benchmarks for Mono compared to say Java in GNU/Linux?
Have you ever tested Mono's performance?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(8)
可以在此处找到本次点球大战的最新版本。
简而言之,与 Java 相比,Mono 使用的内存少得多,运行速度也慢一些。
为了客观地看待事情,从总体上看,它们的运行速度是相同的。 它们运行这些测试的速度都比 Ruby、LUA、Python、PHP 和 Perl 等语言快几个数量级。 它们与 Pascal、OCaml、Haskell 和 LISP 处于同一水平,这使得它们的速度约为 C 和 C++ 的一半。 单击此处了解更多详细信息。
挑剔的是,我们应该清楚我们这里的答案是对 Java 和 Mono C# 进行比较的。 Mono 和 JVM 都是各种语言针对的环境,语言的选择很重要。 例如,如果我们将 Mono 上的 F# 与 JVM 上的 Clojure 进行比较,我们会得到完全不同的结果,突然“Mono”变成了“更快”。
虽然这些比较很有趣且信息丰富,但您必须持保留态度。 首先,尽管有些人这样做,但大多数编写 Java 和 C# 代码的人并不是只在紧密循环中运行数值算法。 其次,在其中一些语言中,测试的算法可能只是调用用 C 编写的库,而不是用目标语言编写的库。 最后,其他基准(和实现)可能会产生不同的结果。
尽管如此,我们还是可以合理地推断 Go 比 Ruby 快得多,C++ 比 Go 快,考虑到 Java 和 C# 的生产力,它们的表现都相当合理(恕我直言)。
The latest version of this shoot-out can be found here.
In a nutshell, compared to Java, Mono uses much less memory and runs a little slower.
To keep things in perspective, they both run about the same speed in the grand scheme of things. They both run these tests orders of magnitude faster than languages like Ruby, LUA, Python, PHP, and Perl. They are both in the same ball-park as Pascal, OCaml, Haskell, and LISP which makes them about half as fast as C and C++. Click here for more detail.
To nitpick, we should be clear that our answers here compare Java and Mono C#. Both Mono and the JVM are environments targeted by various languages and the choice of language matters. For example, if we compare F# on Mono with Clojure on the JVM we get totally different results and suddenly "Mono" is "faster".
While these comparisons are interesting and informative, you have to take them with a grain of salt. First, although some people do, most people writing Java and C# code are not running nothing but numerical algorithms in tight loops. Second, in some of these languages, the tested algorithms may just be calling into libraries that are written in C and not in the target language at all. Finally, other benchmarks (and implementations) would likely yield different results.
Still, it is reasonable to infer that Go is much faster than Ruby, C++ is faster than Go, and both Java and C# perform pretty reasonably given how productive they are (IMHO).
米格尔(Miguel)对此有一篇有趣的文章。
(来源:tirania.org)
在此处查看详细信息
There is an interesting post from Miguel on this.
(source: tirania.org)
See Details Here
惊奇圣人> Miguel 对此发表了一篇有趣的文章。
该图表已经过时了!
这是当前的 Mono C# 4.0 比较
amazedsaint > There is an interesting post from Miguel on this.
That chart is way out of date!
Here's the current Mono C# 4.0 comparison
我针对其他各种虚拟机(包括 OCaml、LLVM、.NET 和 Java)对 Mono 2.2 进行了基准测试< /a>:
Mono 2.2 与 OCaml vs .NET vs LLVM vs JDK http://2.bp.blogspot.com/_NMRkpon4Ps0/SYNY8YtzTCI/AAAAAAAAACg/Bkjli4JV-NU/s1600-h/scimark2_individual.gif
综上所述,Mono 2.2 优于 Mono 2.0但通常仍然比几乎所有其他东西慢很多。
I benchmarked Mono 2.2 against various other VMs including OCaml, LLVM, .NET and Java:
Mono 2.2 vs OCaml vs .NET vs LLVM vs JDK http://2.bp.blogspot.com/_NMRkpon4Ps0/SYNY8YtzTCI/AAAAAAAAACg/Bkjli4JV-NU/s1600-h/scimark2_individual.gif
In summary, Mono 2.2 is better than Mono 2.0 but is still usually a lot slower than almost everything else.
我的基准测试(使用复杂的数学问题和内存操作(使用原始字符串)):
MonoDevelop Windows(使用 .net 3.5 在控制台上运行):
Realizando calculos em 1.000.000 itens... 535
Realizando operações com 字符串只要... 2.038
Realizando calculos em 1.000.000 itens... 530
Realizando operações com 字符串只要... 1.962
Realizando calculos em 1.000.000 itens... 530
Realizando operações com strings longas... 1.963
在 Windows 上使用 mono.exe:
Realizando calculos em 1.000.000 itens... 6.875
Realizando operações com 字符串只要... 6.206
Realizando calculos em 1.000.000 itens... 6.840
Realizando operações com 字符串只要... 6.114
Realizando calculos em 1.000.000 itens... 6.857
Realizando operações com strings longas... 6.116
在 Linux Ubuntu 上使用 mono:
Realizando calculos em 1.000.000 itens... 5,934
Realizando operações com 字符串只要... 6,915
Realizando calculos em 1.000.000 itens... 6,034
Realizando operações com 字符串只要... 7,489
Realizando calculos em 1.000.000 itens... 5,740
Realizando operações com strings longas... 6,731
相同的源代码,但在 Visual Studio 2008 上:
Realizando calculos em 1.000.000 itens... 588
Realizando operações com 字符串只要... 1.289
Realizando calculos em 1.000.000 itens... 566
Realizando operações com 字符串只要... 1.320
Realizando calculos em 1.000.000 itens... 702
Realizando operações com strings longas... 1.393
VS 2008 使用 NGEN(本机可执行文件)生成 exe:
Realizando calculos em 1.000.000 itens... 567
Realizando operações com 字符串只要... 1.255
Realizando calculos em 1.000.000 itens... 563
Realizando operações com 字符串只要... 1.269
Realizando calculos em 1.000.000 itens... 562
Realizando operações com strings longas... 1.263
在这些测试中,mono 比 .net 3.5 SP 1 慢 10 倍 =(
My benchmark (using complex mathematical problems and memory manipulation (with raw strings)):
MonoDevelop Windows (running on console using .net 3.5):
Realizando cálculos em 1.000.000 itens... 535
Realizando operações com strings longas... 2.038
Realizando cálculos em 1.000.000 itens... 530
Realizando operações com strings longas... 1.962
Realizando cálculos em 1.000.000 itens... 530
Realizando operações com strings longas... 1.963
Using mono.exe on Windows:
Realizando cálculos em 1.000.000 itens... 6.875
Realizando operações com strings longas... 6.206
Realizando cálculos em 1.000.000 itens... 6.840
Realizando operações com strings longas... 6.114
Realizando cálculos em 1.000.000 itens... 6.857
Realizando operações com strings longas... 6.116
Using mono on Linux Ubuntu:
Realizando cálculos em 1.000.000 itens... 5,934
Realizando operações com strings longas... 6,915
Realizando cálculos em 1.000.000 itens... 6,034
Realizando operações com strings longas... 7,489
Realizando cálculos em 1.000.000 itens... 5,740
Realizando operações com strings longas... 6,731
Same source code, but on Visual Studio 2008:
Realizando cálculos em 1.000.000 itens... 588
Realizando operações com strings longas... 1.289
Realizando cálculos em 1.000.000 itens... 566
Realizando operações com strings longas... 1.320
Realizando cálculos em 1.000.000 itens... 702
Realizando operações com strings longas... 1.393
VS 2008 generated exe with NGEN (native executable):
Realizando cálculos em 1.000.000 itens... 567
Realizando operações com strings longas... 1.255
Realizando cálculos em 1.000.000 itens... 563
Realizando operações com strings longas... 1.269
Realizando cálculos em 1.000.000 itens... 562
Realizando operações com strings longas... 1.263
In those tests, mono is 10x slower than .net 3.5 SP 1 =(
C++、C#(Mono)、C 和 Vala:http://jpaflacerda.wordpress .com/2011/11/08/vala-benchmarking/
多种语言:http://attractivechaos. github.com/plb/
结论:Mono 发展了很多,但与其他可用语言相比仍然很慢。 我对 Vala 很感兴趣,它的语法与 C# 几乎相同,但在某些情况下比普通 C 更快。
C++, C# (Mono), C and Vala: http://jpaflacerda.wordpress.com/2011/11/08/vala-benchmarking/
Many languages: http://attractivechaos.github.com/plb/
Conclusion: Mono evolved alot, but it is still slow when compared with other languages available. I got interested in Vala, which has almost the same syntax of C# but is faster than plain C in some cases.
大多数基准测试都是基于紧密循环的大量计算。 时间在循环之前开始计时,并在循环之后停止。 如果您的应用程序正在进行繁重的数据处理,那么请避免使用 C# 和 Java,只需使用 C/C++。
您的应用程序更有可能位于服务器端。 它必须接受查询、获取数据并将其发回。 在这种情况下,生成代码的原始速度与其他参数相比并不相关。
你最好看看底层框架的效率如何,代码执行之前的初始化阶段有多快,实现非阻塞 I/O 等高效技术有多容易,之后的内存释放和进程回收情况如何代码执行。 部署代码、扩大规模有多容易……
人的参数比这一切更重要。 写得不好的 Java 比好的 C# 慢,反之亦然。 所以你必须检查你的开发人员。 他们掌握哪种语言,更喜欢哪种工具? 他们是 VS/resharper 上瘾者还是可以使用 Java IDE? 花在学习新语言或 IDE 上的时间不会花在编写更好、更优化的代码上。
Most of the benchmarks are based on heavy computation of tight loops. Time start counting just before the loop and stop just after. If your application is doing heavy data processing then avoid both C# and Java, simply go for C/C++.
It's more likely that your application will be server side. That it will have to accept queries, fetch data and send it back. In such scenario the raw speed of generated code is not relevant compared to other parameters.
You'd better look at how efficient is the underlying framework, how fast is the initialization phase preceding execution of your the code, how easy it is to implement efficient technologies like non blocking I/O, how well is memory released and process recycled after code execution. How easy is it to deploy code, make it scale up...
The human parameter is even more important than all that. A badly written Java is slower than good C# and vice versa. So you have to check your developers. Wich language do they master, wich tool do they like better ? Are they VS/resharper addicts or can they use Java IDE ? The time spend in learning new language or IDE will not be spent on writing better, more optimized code.
我见过一个 http://shootout.alioth.debian.org/gp4/csharp .php
I've seen one http://shootout.alioth.debian.org/gp4/csharp.php