您正在比较apples to oranges。 C#是一种静态类型语言,编译为CIL,它是一种字节码语言,由虚拟机运行(或通常为JITted),用于Web和独立应用程序开发。 Lua是一种动态类型的脚本语言,通常由解释器运行,通常作为可扩展的脚本语言嵌入到更大的应用程序中。
此外,您对基准的解释是错误的。条形图显示,与等效的Lua程序相比,Mono程序大约需要运行时间的十分之一。
也就是说,这种微基准测试基本没用。不要相信我的话;阅读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."
长话短说:选择你的语言是基于它是否能很好地完成你的想法,它是否能让你清楚地表达你的意图,是否能让你写出干净,可维护的代码;不是基于一些毫无意义的数字。