Javascript速度 - Chrome v Firefox [英] Javascript Speed - Chrome v Firefox

查看:139
本文介绍了Javascript速度 - Chrome v Firefox的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 http://amarnus.me/games/dodge 写了这个小游戏。现在,如果你尝试在Firefox和Chrome中玩游戏,你会清楚地注意到,它在Firefox中明显更慢。你可以把它称为无意的欺骗代码,是的。 ; - )

I wrote this small game at http://amarnus.me/games/dodge. Now if you trying playing the game in both Firefox and Chrome, you would clearly notice that it is significantly slower in Firefox. You can call it an unintentional cheat code, yes. ;-)

所以我的问题是 - 这是因为Firefox比Firefox更慢的Javascript引擎?还是它与错误的编码有关? (在我的辩护,我是一个Javascript新手)

So my question is - Is this because of a slower Javascript engine in Firefox when compared to Chrome's? Or does it have something to do with bad coding? (In my defence, I am a Javascript newb)

假设它是前者,那么这不是一个问题(缺点)HTML5游戏? (像使用< canvas> 标签的那些标签)

Assuming that it is the former, then is this not a point against (disadvantage of) HTML5 games? (The ones using the <canvas> tag like mine)

推荐答案

Firefox比JavaScript慢。但是,我相信,使用canvas标签也较慢。这可能会改进与ff4(你试过测试版?)。

Firefox is slower than chrome in javascript. However, I believe that it's also slower using the canvas-tag. This will probably improve with ff4 (have you tried the beta?).

还有一个网络上的nes仿真器使用js和画布,它运行在大约30fps在chrome(如果我记得正确),但只有约10在ff。

There is also a nes emulator out on the web somewhere using js and canvas, and it runs in about 30fps on chrome (if I remember about correctly), but only about 10 in ff.

时间可能是你最好的朋友:-P,虽然你可以alwasy试试优化。

Time is probably your best friend :-P, though you can alwasy try to optimize.

我相信浏览器游戏会来得及时,但它还没有准备好为什么太高级。也许约ie12出来了:-P。

I believe that browser-games will come in time, but it's not ready as of yet to anything too advanced. Maybe about the time ie12 comes out :-P.


Btw:我试过FF4b1的游戏,我以为它跑得很大。可能不如chrome那么快,但不远:)。

Btw: I tried the game in FF4b1, and I thought it ran great. Probably not as fast as in chrome, but not far from it :).

这篇关于Javascript速度 - Chrome v Firefox的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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