什么是PhoneGap的常见来源与jQuery Mobile性能问题? [英] What are common sources of PhoneGap with jQuery Mobile performance issues?

查看:81
本文介绍了什么是PhoneGap的常见来源与jQuery Mobile性能问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用PhoneGap 1.0和jQuery Mobile 1.0b2运行在iPhone和iPad上的应用程序。

I have an application written using PhoneGap 1.0 and jQuery Mobile 1.0b2 running on iPhone and iPad.

自从我开始使用框架,我一直困扰性能问题在应用程序中的页面之间切换。按下按钮后,在转换发生之前,有一个良好的第二次暂停,有时更长。我已经尝试所有的webkit调整在那里,我甚至等待在这两个框架的升级(我开始与Phongap 0.95和jQuery Mobile Alpha 4),这个问题还没有解决。

Ever since I started using the framework, I have been plagued by performance issues switching between "pages" in the application. After pressing the button, there is a good second pause, sometimes longer, before the transition occurs. I've tried all of the webkit tweaks out there, and I've even waited for upgrades in both frameworks (I started with Phongap 0.95 and jQuery Mobile Alpha 4) and this issue has not been resolved.

我使用尽可能多的内置对象(而不是自定义按钮图像),我在每个屏幕上使用我自己的PNG背景。应用程序本身只包含3页,加上一个用作选项屏幕的页面。

I'm using as much "built in" objects as possible (instead of custom button images) and I use my own PNG backgrounds on each screen. The application itself only consists of 3 pages, plus a page that serves as an options screen.

我不想寻找特定的解决方案,在使用PhoneGap和jQuery Mobile for iOS时,存在一些常见的性能问题?

Instead of looking for a specific solution, I'd like to know what are some of the common issues surrounding performance exist when working with PhoneGap and jQuery Mobile for iOS? That way other people can look for a checklist of options when dealing with their own problems

推荐答案

运行你的程序之间最大的区别之一是, jQuery Mobile应用程序在Safari和运行它在UIWebView在本机iOS是缺乏Nitro引擎。它在iOS 4.3中引入。它使JavaScript处理速度是Safari的两倍,但它们无法将其构建为本机应用程序或全屏缓存的Web应用程序。从iOS 5开始,Nitro引擎被带到平台的其余部分。

http://arstechnica.com/apple/news/2011/06/ios-5-brings-nitro-speed-to-home-screen- web-apps.ars

One of the biggest differences between running your jQuery Mobile app in Safari and running it in UIWebView in native iOS is the lack of the Nitro engine. It was introduced in iOS 4.3. It made JavaScript processing about twice as fast in Safari but they failed to build it into native apps or fullscreen cached webapps. As of iOS 5, the Nitro engine was brought to the rest of the platform.
http://arstechnica.com/apple/news/2011/06/ios-5-brings-nitro-speed-to-home-screen-web-apps.ars

除了Nitro引擎,还有其他可能的性能问题,包括jQuery Mobile和页面转换。平台越慢,吸虫越明显。有时它可以表现为在页面呈现之间的白色闪烁。其他时间,它可以表现为:转换到新屏幕 - 闪烁到上一屏幕 - 闪烁到新屏幕。这些吸虫是不一致的,可以试图弄清楚为什么会发生。新的和更快的设备有较少的这个问题,所以好消息是,随着时间的推移,这个问题会消失。构建未来,设备将很快赶上。

Beyond the Nitro engine, there are other possible performance issues surrounding jQuery Mobile and page transitions. The slower the platform, the more noticeable the flukes are. Sometimes it can manifest as a white flicker between page renderings. Other times, it can manifest as: transition to new screen - flash to previous screen - flash to new screen. These flukes are not consistent and can be hell to try to figure out exactly why it's happening. Newer and faster devices have less of a problem with this so the good news is, over time, this problem will disappear. Build for the future, devices will soon catch up.

话虽如此,我们也考虑了用户能够点击他们想要的东西的速度。通过禁用页面转换来最小化转换怪癖。这提供了将有效页面性能提高500毫秒的额外好处。页面转换很漂亮,但事实是,它们很慢。性能是一个特点。

That being said, let's also consider performance in terms of how fast users are able to click what they want. Transition quirks are minimized by disabling page transitions. This gives the added benefit of increasing your effective page performance by 500 milliseconds. Page transitions are pretty, but the fact is, they're slow. Performance is a feature. Just turn off the transitions by including this in your custom scripts.

$(document).bind("mobileinit", function(){
  $.mobile.defaultPageTransition="none";
});

另外,(这可能会发送到社区,可能会读这个)考虑如果你需要实际有一个原生应用程序。除非你需要PhoneGap来访问摄像机,陀螺仪或Safari不能提供的其他硬件支持,你只需使用网络就能获得更好的性能。我理解有一个存在的愿望,有一个应用程序商店,但只有1%的应用程序被发现,他们的半衰期只有几个星期。然后,当有操作系统更新时,您就有发布更新的维护噩梦。只有通过网络发布有很多优势。通过一次更新,您可以更新每个平台上的每个人。所以,考虑平台的性能,但也考虑您的版本的性能。

Also, (and this goes out to the community at large that might read this)... seriously consider if you need to actually have a native app. Unless you need PhoneGap to access the camera, gyroscopes, or some other piece of hardware support that Safari can't offer, you'll always get better performance by just using the web. I understand the desire to have a presence to have an an "app store" but only 1% of apps are ever discovered and their half life is only a few weeks. Then you have the maintenance nightmare of releasing updates whenever there's an update to the OS. There are a lot of advantages to just releasing only over the web. With a single update, you can have everyone on every platform updated. So, consider the performance of the platform, but also consider the performance of your releases.

这篇关于什么是PhoneGap的常见来源与jQuery Mobile性能问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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