performance - 比较 Lua 和 Mono

标签 performance mono lua language-comparisons

<分区>

我想做一些研究,但我找不到关于这个主题的任何信息。

我找到的唯一信息-> http://benchmarksgame.alioth.debian.org/u32/compare.php?lang=csharp&lang2=lua

而且我不确定如何解释这张图表。 如果我是对的,基本上就是说 Lua 比 Mono 快 10 倍。 但是 Mono 的内存使用率是 Lua 的 ~8 倍。

这说明性能如何?

比较 LuaMono -> 优点/缺点

编辑: [游戏开发] Cryengine 3 使用 c++/lua atm。但是有些人为这个引擎发布了一个单端口。我对 Mono 非常熟悉。但现在我想对 Lua 做一些研究,看看是否值得学习这门语言,或者我是否应该坚持使用 Mono

最佳答案

您正在比较 apples to oranges . C# 是一种静态类型语言,编译为 CIL这是一种字节码语言,由虚拟机运行(或通常为 JITted ),用于 Web 和独立应用程序开发。 Lua 是一种动态类型的脚本语言,通常由解释器运行,通常作为可扩展的脚本语言嵌入到更大的应用程序中。

此外,您对基准的解释是错误的。条形图显示,与等效的 Lua 程序相比,Mono 程序的运行时间约为其运行时间的 1/10。

也就是说,这种微基准测试在很大程度上是无用的。不要相信我的话;阅读 what the Shootout itself has to say about it .你应该阅读整篇文章,但我会摘录一些有趣的引文:

"The performance of a benchmark, even if it is derived from a real program, may not help to predict the performance of similar programs that have different hot spots."

"It may seem paradoxical to use an interpreted language in a high-throughput environment, but we have found that the CPU time is rarely the limiting factor; the expressibility of the language means that most programs are small and spend most of their time in I/O and native run-time code."

"Programming languages are compared against each other as though their designers intended them to be used for the exact same purpose - that just isn't so."

长话短说:选择您的语言取决于它是否能很好地完成您想用它做的事情,它是否能让您清楚地表达您的意图,它是否能让您编写干净、可维护的代码;不是基于一些基本上没有意义的数字。

关于performance - 比较 Lua 和 Mono,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10880418/

相关文章:

c# - 如何获取 Mono Xamarin Android 应用程序路径文件夹?

date - 如何在Lua中打印出这种格式的日期和时间?

multithreading - 为什么这个简单的 Lua 协程不起作用?

java - Array 和 ArrayList 位置访问性能

c# - 我可以将哪些命令行构建工具(如 make)与 Mono C# 一起使用?

sql - 提高第一个查询的性能

f# - 如何为旧版 F# 应用程序提供 ResizeArray?

parsing - 如何使用Lua语言从磁盘加载Lua表?

c - 从预填充的随机缓冲区中提取基 K 随机 “bits”

mysql - 构建关注者/关注 MySQL 数据库的最佳实践