简体   繁体   English

iPhone Web应用程序:性能热点? 缓存? JavaScript瓶颈?

[英]iPhone web apps: performance hotspots? Caching? JavaScript bottlenecks?

I'm starting to make an iPhone app with jQTouch - so I'm keen to hear some best practises. 我开始使用jQTouch制作iPhone应用程序-因此,我很想听听一些最佳实践。

I'm developing for iPhones users on a UK 3G connection. 我正在为英国3G连接上的iPhone用户开发。

  • Any particular things that cause script blocking? 是否有导致脚本阻塞的特殊情况?
  • What are the main performance hotspots? 主要表现热点是什么?
  • Whats the deal with browser caching? 浏览器缓存如何处理?
  • If the iPhone doesn't cache should I include my scripts and styles in the page? 如果iPhone不缓存,是否应在页面中包含脚本和样式?

Basically, I'm looking for some general tips and absolute no-no's! 基本上,我在寻找一些一般性提示和绝对禁止!

I have developed four web apps for the iPhone specifically, the first two using JQTouch and the last two using my own framework I put together in a day and a half - I switched from JQTouch because it was slow, unwieldy and heavy to use, and my own replacement was significnatly lighter, faster and did everything exactly as I wanted it. 我专门为iPhone开发了四个Web应用程序,前两个使用JQTouch,后两个使用我自己的框架,我用了一天半的时间将它们组合在一起-我从JQTouch切换到Google,因为它使用起来缓慢,笨拙且繁琐,并且我自己的替代产品明显更轻,更快,并且完全按照我的要求进行了所有操作。

Regarding caching, take a good look at the cache manifest file that Safari implements as part of html5 - this will give hints to Safari as to what needs to be cached locally and cuts down on access times a lot. 关于缓存,请仔细查看Safari作为html5的一部分实现的缓存清单文件-这将向Safari提示需要在本地缓存哪些内容,并大大减少了访问时间。

Keep your page sizes down - if you have a lot of data, use html5 local storage to store data and JQuery to dynamically create application pages as you go. 减小页面大小-如果您有大量数据,请使用html5本地存储来存储数据,并使用JQuery动态创建应用程序页面。 JQuery can choke if you do not design your page hierarchy well, and have lots of elements in the page (my last project had 50 top level categories, each with 10 subcategories, each with 10 options - putting all of those in the page itself caused JQuery to hang for 5 to 10 seconds on first lookup, while moving all of the data into html5 local storage and doing sql selects to build the page sped the entire process up considerably). 如果您不能很好地设计页面层次结构,并且页面中包含很多元素,JQuery可能会阻塞(我的上一个项目有50个顶级类别,每个类别都有10个子类别,每个类别都有10个选项-将所有这些放在页面本身中会导致第一次查询时,JQuery会挂起5到10秒,同时将所有数据移到html5本地存储中,并执行sql selects来构建页面,从而大大加快了整个过程。

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

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