Mono虚拟机目前的性能如何?

How is the current performance of the Mono virtual machine?(Mono虚拟机目前的性能如何?)

本文介绍了Mono虚拟机目前的性能如何?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

网络上充斥着不同语言、编译器和虚拟机的各种性能测试.然而,几乎没有任何一个使用一些真实场景来测试性能.此外,在 Google 上搜索这类基准通常只产生几年前的基准,因为这些基准有最多的时间来收集指向它们的链接.

The web is full of different kinds of performance test of different languages, compilers, and virtual machines. Yet hardly any of these test the performance using some real-world scenario. In addition, searching Google for these kind of benchmarks usually yields mainly only several years-old benchmarks as those have had the most time to gather links to them.

你们中是否有人真正了解不同虚拟机的当前性能?此外,我特别想知道 Mono 的性能与 Microsoft 的 .Net 和 Sun 的 Java 相比如何,以及最近不同虚拟机的性能如何发展.

Do any of you have some real insight into the current performance of different virtual machines? In addition I'd especially like to know how Mono's performance compares to those of Microsoft's .Net and Sun's Java and how the performance of different virtual machines has evolved lately.

推荐答案

衡量性能是一件复杂的事情.过去,当针对相同的操作系统、运行相同的硬件和一组非常有限的库对语言进行测试时,就有可能创建可以提供衡量系统的线性指标的基准.它可以让人们从零到十评估事物,吸收结果并快速进入下一个主题.

Measuring performance is a complicated matter. In the past, when languages were tested against the same operating system, running the same hardware and a very limited set of libraries it was possible to create benchmarks that could give a linear metric that would measure a system. It would let folks evaluate things from zero to ten, assimilate the result and move on quickly to the next subject.

现代系统的情况变得更加复杂,因为需要考虑多个变量.

Things have become more complicated with modern systems as there are multiple variables to take into account.

至少在 Mono 的情况下,有很多变量可以发挥作用:

At least in Mono's case there are plenty of variables that come into play:

  • 代码:

  • 生成的本机代码的质量.
  • 生成本机代码的速度.
  • 生成代码和优化代码所需的内存
  • 代码生成器是多线程的
  • 生成的代码是线程安全的
  • 它是否在编译时或 JIT 时利用 CPU 特定功能.
  • 如果可用,它是否可以使用 SIMD 指令.
  • 语言本身是否整齐地映射到多核平台
  • 该语言是否为优化器提供了足够的参数来自动调整您的代码(就像 Fortran 一样).

内存管理:

  • 使用的垃圾回收算法
  • GC 是否可以使用多个 CPU 进行扩展?
  • GC 是增量的还是实时的?
  • 它是否支持线程本地存储以提高性能?
  • 它是精确的、紧凑的、代际的、保守的,还是两者兼而有之.

API 设计:

  • API 是针对延迟还是带宽设计的
  • API 是否支持自动扩展到多个 CPU.
  • 您能否将繁重的工作转移到 GPU 上?
  • 您的 API 是否支持流接口

所有这些事情都使事情变得非常复杂,并且很难给出一个简单的 0 到 10 答案.

All of these things complicate matters very much and make a simple 0 to 10 answer very hard to give.

如果您要将语言划分为类,并且假设您是一位称职且具有性能意识的程序员,那么我会将世界划分为这些类:

If you were to partition languages in classes, and you assume a competent and performance aware programmer, I would divide the world in these classes:

  • 第 1 层:由专业人员手动调整的汇编语言
  • 第 2 层:静态编译的强类型语言:C/C++/Fortran/
  • 第 3 层:托管/JIT 语言:Java/C#/.NET/Mono/Boo/F#
  • 第 4 层:动态类型/JIT 语言:Google V8、IronPython、IronRuby
  • 第 5 层:纯解释型语言:Python、Perl
  • 第 6 层:纯解释型语言,其功能太多.

但是语言并不能描绘完整的画面,您将使用的 API、托管操作系统和其他设施将对您的结果产生重大影响.

But the languages do not paint an entire picture, the APIs that you will consume, the hosting operating system and other facilities will have a big impact on your results.

例如,最近在 Mono 中,我们添加了对用更高级、高度优化的引擎(LLVM 引擎)替换 Mono 的代码生成引擎的支持.事实证明,很难找到使用 LLVM 的开销值得额外内存使用的测试:桌面和 Web 应用程序并没有表现出太大的差异.这可能是由于这些主要是 I/O 绑定应用程序.

For example, recently in Mono we added support for replacing Mono's code gen engine with a more advanced, highly optimizing engine (the LLVM engine). It turns out that it was incredibly hard to find a test where the overhead of using LLVM was worth the extra memory use: desktop and web applications did not exhibit much of a difference. And this is probably due to the fact that these are mostly I/O bound applications.

使用 LLVM 对于科学和计算密集型应用程序很有用,但在现实生活中,它与 Mono 的默认优化设置并没有太大区别.

Using LLVM was useful for scientific and computationally intensive applications, but in real life it did not make much of a difference from Mono's default optimization settings.

至于 Mono 的细节:虽然 Mono 确实使用了 Boehm 的 GC,但大多数人没有意识到 Boehm 可以通过多种方式进行配置.默认的外行配置确实不是很强大,但它适用于所有想要快速 GC 的人.Mono 在这种模式下不使用 Boehm,Mono 将 Boehm 广泛配置为在精确模式下工作,并利用线程本地存储、多核 GC 和释放内存到操作系统模式.

As for the specifics of Mono: although Mono does use Boehm's GC, what most folks do not realize is that Boehm can be configured in various ways. The default layman configuration is indeed not very powerful, but it works for everyone that wants a quick GC. Mono does not use Boehm in this mode, Mono configures Boehm extensively to work in precise-mode as well taking advantage of thread local storage, multi-core GC and release-memory-to-the-OS modes.

这篇关于Mono虚拟机目前的性能如何?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:Mono虚拟机目前的性能如何?

基础教程推荐