为什么是C那么快,为什么没有其他语言一样快或更快? [英] Why is C so fast, and why aren't other languages as fast or faster?

查看:188
本文介绍了为什么是C那么快,为什么没有其他语言一样快或更快?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在听计算器播客,戳不断想出说:真正的程序员,在 C写的和该 C 是如此之快,因为它是靠近机器。

In listening to the StackOverflow podcast, the jab keeps coming up that "real programmers" write in C and that C is so much faster because it's "close to the machine."

离开前断言另一篇文章,有什么特别之处 C ,使得它比其他语言更快?

Leaving the former assertion for another post, what is special about C that allows it to be faster than other languages?

或者换一种说法:什么是从能够向下编译到快速运行的每一点 C

Or put another way: what's to stop other languages from being able to compile down to binary that runs every bit as fast as C?

推荐答案

没有太多的特别之处C.这就是为什么它的速度快的原因之一。

新的语言其中有垃圾收集支持的dynamic打字和其他设施,使它更容易为程序员写程序。

Newer languages which have support for garbage collection, dynamic typing and other facilities which make it easier for the programmer to write programs.

美中不足的是,有额外的处理开销,这将降低应用程序的性能。 C没有任何的是,这意味着没有额外开销,但是这意味着程序员需要能够分配存储器并把它们释放到prevent 内存泄漏和必须处理的变量静态类型。

The catch is, there is additional processing overhead which will degrade the performance of the application. C doesn't have any of that, which means that there is no overhead, but that means that the programmer needs to be able to allocate memory and free them to prevent memory leaks, and must deal with static typing of variables.

这是说,许多语言和平台,如Java(与它的Java Vitual机)和.NET(与公共语言运行库)已经提高了性能,多年来与降临如的just-in-time 来获得更高的性能。

That said, many languages and platforms, such as Java (with its Java Vitual Machine) and .NET (with its Common Language Runtime) have improved performance over the years with advents such as just-in-time compilation which produces native machine code from bytecode to achieve higher performance.

这篇关于为什么是C那么快,为什么没有其他语言一样快或更快?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆