简体   繁体   English

Canvas HTML5性能-Chrome的运行速度明显比Firefox和IE慢

[英]Canvas HTML5 Performance - Chrome significantly slower than Firefox and IE

I have written a game using HTML5 and Javascript. 我已经使用HTML5和Javascript编写了游戏。 The game can be played at www.be-sw.com/game/2. 可以在www.be-sw.com/game/2上玩游戏。 I don't think posting the code here will be helpful as it is lengthy. 我认为在这里发布代码不会很费力,因为它很长。 It uses two loops; 它使用两个循环。 a game logic loop and a request animation frame loop and I don't think there's anything particularly complex in the logic. 游戏逻辑循环和请求动画框架循环,我认为逻辑上没有什么特别复杂的。

Until recently it worked at the same speed on Chrome, IE and Firefox on all computers where it was tested. 直到最近,它在所有经过测试的计算机上的Chrome,IE和Firefox上均以相同的速度工作。

However, it has suddenly started performing differently on Chrome v38 on some computers - Chrome slows the entire game to 10% of it's speed so the game becomes extremely slow to play. 但是,它突然开始在某些计算机上的Chrome v38上表现不同-Chrome将整个游戏的速度降低到其速度的10%,因此游戏变得极其缓慢。 I can't identify any potential causes of this variation - it seems random whether Chrome plays it slow or normal on a computer. 我无法确定这种变化的任何潜在原因-Chrome在计算机上播放缓慢还是正常似乎是随机的。 On all computers it works fine on FF and IE. 在所有计算机上,它在FF和IE上均可正常运行。

On the computers where the issue occurs, using Chrome's profiler, I can see that the issue is not CPU usage it only uses 2-3% of CPU at most) and there is normally a significant percent idle. 在发生问题的计算机上,使用Chrome的探查器,我可以看到问题不是CPU使用率,它最多仅使用2-3%的CPU),并且通常有相当大的空闲百分比。 At times Program uses 20-30% but there is still always idle CPU. 有时,程序使用20%到30%的内存,但是仍然总是有空闲的CPU。

Any suggestions as to what might be causing this / how I can approach resolving it? 关于可能导致此问题的任何建议/如何解决该问题?

It looks like Chrome v38 has introduced at least one issue with canvas performance. Chrome v38似乎至少引入了一个 canvas性能问题。 If Chrome 37 continues to perform normally, I'd put it down to a Chrome bug/regression. 如果Chrome 37继续正常运行,那么我将其归咎于Chrome的错误/回归。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM