在Android设备上的JavaScript / HTML / CSS应用 - 极其缓慢 [英] JavaScript/HTML/CSS applications on Android devices - extremely slow

查看:188
本文介绍了在Android设备上的JavaScript / HTML / CSS应用 - 极其缓慢的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在一些JavaScript游戏。他们在iPhone和iPad和桌面完美运行也是如此。最大的问题是Android设备。当JavaScript执行和内容呈现的所有平板电脑,我们有蜂窝OS 3.x的(三星标签10.1,摩托罗拉Xoom,宏碁Iconia等等)是非常缓慢的。它是2.x的手机好,但仍远远落后于苹果设备...

We are making some JavaScript games. They run perfectly on iPhone and iPad and desktop as well. The biggest problem are Android devices. All tablets we have with Honeycomb OS 3.x (Samsung Tab 10.1, Motorola Xoom, Acer Iconia, etc.) are extremely slow when JavaScript is executed and content is rendered. It is better on 2.x phones, but still far behind Apple devices…

我们试图用传统的方法是 div元素 HTML5的画布,但即使是简单的反弹球的例子是极其缓慢(如果你想测试一下,访问 http://sie.mautilus.com/canvas )。

We tried to use the traditional approach with div element as well as HTML5 canvas, but even simple bouncing ball example is extremely slow (If you want to test it, access http://sie.mautilus.com/canvas).

如果我们在Android上的调试菜单中禁用的启用OpenGL渲染的是稍微好一点,但仍然不能用于广泛的受众,而不是谈论的事实,即普通用户将无法做到这一点?

If we disable in the debug menu on Android the Enable OpenGL Rendering it is slightly better, but still not usable for wide audience, not speaking about the fact, that normal user will not do this…

这使得基于JavaScript的用户界面,这是事件有点复杂在Android上完全无法使用...

This makes the JavaScript based user interface, which is event bit complicated totally unusable on Android…

这怎么是简单的反弹球,这是在我的英特尔386的机器上运行在MS-DOS是不可用的高端平板电脑双核1GHz的的Cortex-A9处理器?

How it is that the simple bouncing ball, which was running in MS-DOS on my Intel 386 machine is unusable on high-end tablets with dual-core 1 GHz Cortex-A9 CPUs?

参见有:
HTTP://$c$c.google.com/p /安卓/问题/详细信息?ID = 17353
http://groups.google.com/group/phonegap/browse_thread/thread/fc13b40165db8a00?pli=1a

See also there:
http://code.google.com/p/android/issues/detail?id=17353
http://groups.google.com/group/phonegap/browse_thread/thread/fc13b40165db8a00?pli=1a

问候, 斯登

推荐答案

您是正确的,它是在Android设备很慢,我遇到了同样的问题,在网上搜索我只发现人们同意我们的。

You are correct that it's very slow on android devices, i ran into the same problem and searching the internet I only find people that agree with us.

我做了几件事情要加快速度(尽管它与低质量)。我也只检查了HTC感觉和三星Galaxy Tab 10.1。我不认为你需要使用不同的设置为不同的手机。

I did a few things to speed things up (although it comes with lower quality). I also only checked on HTC Sensation and Samsung galaxy tab 10.1. I do think that you will need to use different settings for different phones.

  1. 设置的屏幕尺寸,所以我的手机犯规创造更大的画布上,然后再扩展它。
  2. 扩大现场由2倍。这将减少所使用的像素减半,让你拥有真正的小画布绷在全屏
  3. 在不使用clearRect清除整个画布,然后重绘一切。实际删除和clearRect你的弹跳球例子将展示一个很大的改进。清除实际变化(蝙蝠和球),然后重新绘制的区域也就足够了。

在一个侧面不是我注意到,机器人2和4进行再快3,但这是基于测试的只有3个设备,所以并不难统计。

On a side not I noticed that android 2 and 4 perform faster then 3, but that is based on testing with just 3 devices, so not hard stats.

我也看了,使用translate3d在画布上,将触发硬件(如果可用)的渲染,但我还没有查/证实了这一点。

I also read that using translate3d on a canvas will trigger hardware rendering if available, but I havent checked/confirmed this.

有些code可以帮助你:

Some code that might help you:

<meta name="viewport" content="width=device-width, initial-scale=0.5, user-scalable=no"/>


$(gameEl).css('-webkit-transform', 'scale3d(2, 2, 0) translate3d(0, 0, 0)');
$(gameEl).css('-webkit-transform-origin', '0 0');

这篇关于在Android设备上的JavaScript / HTML / CSS应用 - 极其缓慢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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