如何加速jquery手机/ phonegap? [英] How to speedup jquery mobile / phonegap?
问题描述
我有一个小的网络应用程序。共7页,总共3.6 KB index.html和855.5 KB。我唯一奇怪的是一个数据库(〜500kb)在Javascript中有很多行如:
$。data(db, 'Aarstraße',['34236:1','34246:2','34270:4','34290:6',...]
我在iPod / iPhone和Android(HTC Magic)上测试了它, p>
启动
- iPhone:14秒
- Android:21秒
简单页面转换(幻灯片)
- iPhone:3-4秒
- Android:4-6秒
<
我已经移除了框阴影。
更新
$ b
我删除数据库,共有444.7KB的页面。现在它在Android上运行得更快。大约相同的一个iPhone。
http://stackoverflow.com/questions/9004308/jquery-mobile-transitions-judder-on-android/9004548\">这个问题,我切换到最新的jquery mobile build 。它将缓慢的Android设备的页面转换改进为每次转换大约2秒。版本1.1的发布将中/晚2月。
您可以执行以下操作:
- 获取deviceready更快。
- 使用 YUI Compressor 最小化您的JS代码
- 将您的指令码标记移至body标记底部。
已经提到你已经把数据库移出了方程式,这可能需要大量的时间在启动。
I have a small web app. Seven pages, 3.6 KB index.html and 855.5 KB total. The only odd thing i have is a database (~500kb) in Javascript with many lines like:
$.data(db,'Aarstraße',['34236:1','34246:2','34270:4','34290:6',...]);
I tested it on iPod/iPhone and Android (HTC Magic) and it is very slow:
Startup
- iPhone: 14 seconds
- Android: 21 seconds
Simple page transition (slide)
- iPhone: 3-4 seconds
- Android: 4-6 seconds
How can I make this fast?
I already removed the box shadow.
Update
I remove the database leaving 444.7KB page total. Now it runs faster on Android. Around the same as one iPhone. It still feels very slow.
Update 2
After this question, I switched to the latest jquery mobile build. It improved the page transitions for slow Android devices to ~2 seconds per transition. Release of Version 1.1 will be mid/late February.
There are a few things you can do:
- Get to deviceready faster.
- Minimize your JS code using YUI Compressor
- Move your script tags to the bottom of the body tag.
As you've already mentioned you've moved the database out of the equation which was probably taking a bulk of the time on startup.
这篇关于如何加速jquery手机/ phonegap?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!