Silverlight是否比JavaScript具有性能优势? [英] Does Silverlight have a performance advantage over JavaScript?

查看:90
本文介绍了Silverlight是否比JavaScript具有性能优势?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在最近关于Silverlight的讨论中,提出了速度的优势。 Silverlight的论点是它在浏览器中的表现比Javascript好,因为它是编译(和管理)的代码。

At a recent discussion on Silverlight the advantage of speed was brought up. The argument for Silverlight was that it performed better in the browser than Javascript because it is compiled (and managed) code.

然后声明这个优势仅适用于IE因为IE解释了与其他浏览器(例如Chrome和FireFox)相比效率低下的Javascript,这些浏览器在执行前将Javascript编译为机器代码,因此与Silverlight一样执行。

It was then stated that this advantage only applies to IE because IE interprets Javascript which is inefficient when compared to that of other browsers such as Chrome and FireFox which compile Javascript to machine code before execution and as such perform as well as Silverlight.

有没有人对这个性能问题有明确的答案。即,Silverlight和Javascript在Chrome和Firefox上具有相似的性能吗?

Does anybody have a definitive answer to this performance question. i.e. Do/will Silverlight and Javascript have comparable performance on Chrome and Firefox?

推荐答案

推测很有趣。或者我们实际上可以尝试一两个测试......

Speculating is fun. Or we could actually try a test or two...

Silverlight与Javascript国际象棋样本。当我运行它时,C#平均每秒420,000个节点,而Javascript平均每秒23,000个节点。我正在运行Google Chrome的开发分支(v.4.4.154.25)。对于Silverlight而言,这几乎仍然是18倍的速度优势。

That Silverlight vs. Javascript chess sample has been updated for Silverlight 2. When I run it, C# averages 420,000 nodes per second vs. Javascript at 23,000 nodes per second. I'm running the dev branch of Google Chrome (v. 0.4.154.25). That's still almost an 18x speed advantage for Silverlight.

Primes计算显示Silverlight的3倍优势:在 Javascript 需要3.7秒,在 Silverlight 需要1.2秒。

Primes calculation shows a 3x advantage for Silverlight: calculating 1,000,000 primes in Javascript takes 3.7 seconds, in Silverlight takes 1.2 seconds.

所以我认为,对于计算,Silverlight仍然具有相当强大的优势,我的直觉是它可能会保持这种状态。双方都将继续优化,但在动态语言中可以优化的内容有一些限制。

So I think that for calculation, there's still a pretty strong advantage for Silverlight, and my gut feel is that it's likely to stay that way. Both sides will continue to optimize, but there are some limits to what you can optimize in a dynamic language.

Silverlight还没有(当时)有优势动画。例如, Bubblemark 测试显示Javascript以170 fps运行,Silverlight以100 fps运行。我想我们可以期待看到这种变化当Silverlight 3发布时,因为它将包括GPU支持

Silverlight doesn't (yet) have an advantage when it comes to animation. For instance, the Bubblemark test shows Javascript running at 170 fps, and Silverlight running at 100 fps. I think we can expect to see that change when Silverlight 3 comes out, since it will include GPU support.

这篇关于Silverlight是否比JavaScript具有性能优势?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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