今天遇到iphone上webkit的缓存问题,查到老外的一篇文章,感觉非常不错,转过来分享。
原文链接:http://www.yuiblog.com/blog/2010/06/28/mobile-browser-cache-limits/

下面是部分摘录:
1.Android

The Android browser exhibited the best cache behavior of all devices tested. While it appears to impose no limit on the size of individual components, the total cache size seems to be limited to approximately 2MB, which means that individual components are effectively limited to 2MB as well.

The page cache appeared to impose no limit on the size of individual pages, happily caching every byte I threw at it until the available RAM was exhausted and the browser crashed.

I was pleasantly surprised to find that Android’s component cache survived both browser restarts and power cycles, a feat none of the iOS devices was able to match.

Possible caveat: A review of Android’s WebKit source tree leads me to believe that its cache limits may adapt based on the amount of RAM and/or flash memory available on the particular device on which it’s running. If true, these numbers may only be applicable to the Nexus One. In fact, if the cache size adapts based on unused memory rather than total memory, these numbers may only be applicable to my Nexus One.

I could be mistaken, but the differences in the iOS 4.0 test results on the iPhone 3GS and iPhone 4 support this theory. (Android and Mobile Safari are both WebKit-based browsers, so they may have this behavior in common.) If you’re familiar with the WebKit source and can shed more light on this, please get in touch with me.



2.iOS

Results varied wildly across the three most recent versions of iOS. Astonishingly, Mobile Safari on iOS 3.1.3 did not cache components of any size, despite having an apparently unlimited page cache size. This is troubling since it means iOS 3.1.3 users are likely getting a suboptimal browsing experience, especially if they aren’t using wifi. The unlimited page cache size does little good here, since it only comes into play for back/forward navigations. This behavior is a significant change from what others observed in previous iOS releases and I can’t imagine any good reason for it, so I suspect this may be a bug.

Mobile Safari on iOS 3.2 (which is only available on the iPad) does not exhibit this bug. Its 25.6KB component limit and ~281.6KB total cache limit are better than nothing, but they still seem paltry compared to the other devices tested. Uniquely among iOS devices, the iPad appears to limit the size of pages in the page cache to 25.6KB, the same as its component size limit.

Mobile Safari on iOS 4.0 exhibited different limits on the iPhone 3GS and on the iPhone 4, which implies that the limits adapt based on available RAM (the iPhone 3GS has 256MB while the iPhone 4 has 512MB; both devices tested had 32GB of flash memory). On the iPhone 3GS, iOS 4.0 has a 51.199KB component size limit and a ~1.05MB total component cache size.

On the iPhone 4, the component size limit was almost exactly two times the limit on the iPhone 3GS, at 102.399KB. The total component cache size was approximately 1.9MB. Perhaps because iOS 3.2 and iOS 4.0 were developed separately but branched from a common ancestor, the iOS 4.0 page cache size appears to be limited only by available RAM on both devices tested, just like iOS 3.1.3.

None of the iOS devices preserved the contents of the cache across forced browser restarts or device power cycles, although they did preserve the cache when merely switching applications without actually killing the browser.

更多相关文章

  1. Android(安卓)调用 startActivityForResult(intent,requestCode)
  2. 《Android开发艺术探索》摘录2
  3. 【摘录】Android中UI视图之试图绘制机制
  4. Dalvik opcodes 【转过来 备份】
  5. Android中ListView滚动时上下的那一抹色彩
  6. 【摘录】FrameLayout 的絕對座標設定方法
  7. Android(安卓)APPT2 报异常处理
  8. Android变成setContentView()报错空指针异常
  9. Android(安卓)指南针

随机推荐

  1. 全球十个最佳Android应用
  2. [置顶] android 实现发送彩信方法 (MMS),
  3. Android(安卓)Dialog设置TYPE_SYSTEM_ALE
  4. android 笔记 --- Intent 应用
  5. android Java BASE64编码和解码一:基础
  6. ProgressBar
  7. android 应用的网络请求工具
  8. 手把手教你搭建 Android(安卓)SVN 环境
  9. android task与back stack 开发文档翻译
  10. Android(安卓)tablet Fragment 中 TableL