简体   繁体   English

Android平板电脑:HTML5画布的浏览器性能非常差

[英]Android Tablet: Very poor Browser performance for HTML5 canvas

I bought a new tablet (Asus Memo Pad 10, Android 4.2). 我购买了新的平板电脑(Asus Memo Pad 10,Android 4.2)。 One of the first things I did was try to run a small HTML5 canvas game that i wrote. 我做的第一件事就是尝试运行我编写的一个小型HTML5画布游戏。 I saw that the frame rate was very bad (3 fps), which is very weird, because my mother has the same talet and on hers it runs with 30 fps. 我看到帧速率非常差(3 fps),这很奇怪,因为我的母亲有相同的Talet,而她的Talet却以30 fps的速度运行。 I also got another tablet which is about the same speed and this one also runs at ~30 fps, same for my phone, which should also be pretty much the same performance, and also runf fine on that. 我还得到了另一台速度相同的平板电脑,该平板电脑也以〜30 fps的速度运行,与我的手机一样,应该也具有几乎相同的性能,并且运行效果还不错。 This happens for all browsers, i tried chrome, FF and Opera, all have 3 or 4 fps. 对于所有浏览器都会发生这种情况,我尝试使用chrome,FF和Opera,它们都具有3或4 fps。 Apart from that, the tablet seems to be fine, i tried other games, for example Heartstone, which runs fine, also I ran a benchmark (pcmark) which gave me an everage result for this tablet. 除此之外,这款平板电脑似乎还不错,我尝试了其他游戏,例如运行良好的Heartstone,还运行了基准测试(pcmark),这使我在这款平板电脑上获得了无与伦比的效果。 Im really wondering why the performance for my game is so bad. 我真的很想知道为什么我的游戏性能这么差。 All it does is some basic 2d canvas rendering. 它所做的只是一些基本的2d画布渲染。 No js errors in console. 控制台中没有js错误。 I dont use any libs / frameworks. 我不使用任何库/框架。 I use requestAnimationFrame() for rendering. 我使用requestAnimationFrame()进行渲染。 When i use setTimeout() or setInterval() instead, the game suddenly runs at much higher fps, but fails to actually render at that speed, so it still actually looks like 3 fps or so, while the loop runs 50 or 60 times a sec. 当我改用setTimeout()或setInterval()时,游戏突然以更高的fps速度运行,但实际上无法以该速度进行渲染,因此它实际上仍然看起来像3 fps左右,而循环运行了50或60次秒。 This also happens when i put the "setTimeout" call at the end of the loop. 当我将“ setTimeout”调用放在循环末尾时,也会发生这种情况。 Another thing to note is: when i check performance with chrome dev tools, it looks like the cpu is like 90% idle, which somehow would explain why the game runs so slow. 要注意的另一件事是:当我使用chrome开发工具检查性能时,看起来cpu就像90%处于空闲状态,这以某种方式可以解释为什么游戏运行如此缓慢。

Anyone has an idea why this is happening and what i could do about it ? 任何人都知道为什么会发生这种情况,我对此怎么办?

Ok, i played around in the chrome flags (chrome://flags) and eventually it was possible to enable 2d canvas rendering, which my GPU (Mali 400 MP) seems to not support properly by default. 好的,我玩了chrome标志(chrome:// flags),最终有可能启用2d canvas渲染,而我的GPU(马里400 MP)默认情况下似乎不正确支持。 After flagging all the 2d canvas stuff it eventually works and 2d canvas is now accelerated, at least for Chrome. 标记完所有2d画布内容后,它最终可以工作,并且现在至少在Chrome中加速了2d画布。

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

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