V8 下的 Javascript 比其他语言上的同等代码更快吗?

发布于 2024-09-10 05:13:19 字数 70 浏览 2 评论 0原文

有人知道 V8 上的 Javascript 是否比其他语言(例如 Python、Perl、PHP 等)上的等效代码运行得更快?

Anyone know whether Javascript on V8 runs faster than equivalent code on other languages such as Python, Perl, PHP etc...?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

妖妓 2024-09-17 05:13:19

是的,根据计算机语言基准游戏 ,但是要小心解释人工基准测试的结果

默认比较是与 Java 进行比较,Java 通常速度更快,但您可以将其与 Perl、PHP 以及一些 Ruby 和 Python 实现进行比较。除了使用大整数的基准测试之外,它似乎大多更快,因为 JavaScript 本身并不支持它们。

Yes, according to the Computer Language Benchmarks game, but be careful interpreting results from artificial benchmarks.

The default comparison is to Java, which is generally faster, but you can compare it to Perl, PHP and several Ruby and Python implementations. It seems to be mostly faster except in the benchmarks that use big integers, because JavaScript doesn't support them natively.

柠栀 2024-09-17 05:13:19

这取决于应用程序。在相同的特定情况下,从长远来看,它比 GCC/C++ 更快。

http://wingolog.org/archives/2011/ 06/10/v8-is-faster-than-gcc

在此处输入图像描述

没错,V8 总是比 GCC 快,直到它的修复数开始失败。根据记录,只有图表右侧的点真正有价值,因为左侧的点仅运行几毫秒。

亚当克 说:

看起来合乎逻辑。 GCC只处理代码一次,处理完之后就没有改进的空间了。 V8 一遍又一遍地处理相同的代码,并且可以随着时间的推移改进优化。

您通常只使用 GCC 编译代码一次。没有人每次想要使用某些东西时都会编译所有内容。因此,比较 V8 和 GCC 之间的编译+运行时间是不公平的 - GCC 要创建好的代码要困难得多,因为它无法随着时间的推移而改进它。

It depends of the application. In same specific cases it's faster than GCC/C++ in the long run.

http://wingolog.org/archives/2011/06/10/v8-is-faster-than-gcc

enter image description here

That's right, V8 is always faster than GCC, right up to the point at which its fixnums start failing. For the record, only the points on the right of the graph are really worth anything, as the ones on the left only run for a few milliseconds.

AdamK says:

Seems logical. GCC deals with the code only once, ant after it's done there is no room for improvement. V8 deals with the same code over and over and can improve optimization over time.

You usually compile code with GCC only once. Noone compiles everything everytime he wants to use something. So, comparing compile+run time between V8 and GCC is not fair - GCC has much harder job to do to create good code, because it can't improve it over time.

那些过往 2024-09-17 05:13:19

不。从性能角度来看,没有人可以击败由专家编写的(例如 Node.js)实现,该专家花了一年时间在汇编器中实现它,重点是性能(由基准和计时信息支持,这些信息在发布版本),适用于特定架构和特定数据文件。

当然,瓶颈在于下载程序,而不是实际的运行时性能,但是,考虑到其大小,手工制作的汇编程序仍然很难被击败。

No. Nobody can beat, performance wise, an implementation of (eg, Node.js) written by an expert who has spent a year implementing it in assembler, with a focus on performance (backed by benchmarks and timing information, which is removed in a release version), for a particular architecture and particular data file.

Of course, the bottleneck is downloading the program, not in the actual runtime performance, however, hand-crafted assembler would still be very hard to beat given its size.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文