GithubHelp home page GithubHelp logo

androidwebview's Introduction

AndroidWebView

Android WebView

引用:简书文章:Android:手把手教你构建 WebView 的缓存机制 & 资源预加载方案 链接:http://www.jianshu.com/p/5e7075f4875f 作者:Carson_Ho

Android Webview 的性能问题,特别突出的是:加载速度慢 & 消耗流量

  1. H5 页面加载速度慢 1.1 渲染速度慢 前端H5页面渲染的速度取决于 两个方面:

     ----Js 解析效率
     Js 本身的解析过程复杂、解析速度不快 & 前端页面涉及较多 JS 代码文件,所以叠加起来会导致 Js 解析效率非常低
    
     ----手机硬件设备的性能
     由于Android机型碎片化,这导致手机硬件设备的性能不可控,而大多数的Android手机硬件设备无法达到很好很好的硬件性能
    
     总结:上述两个原因 导致 H5页面的渲染速度慢。
    

    1.2 页面资源加载缓慢 H5 页面从服务器获得,并存储在 Android手机内存里:

     H5页面一般会比较多
     每加载一个 H5页面,都会产生较多网络请求:
     HTML 主 URL 自身的请求;
     HTML外部引用的JS、CSS、字体文件,图片也是一个独立的 HTTP 请求
     每一个请求都串行的,这么多请求串起来,这导致 H5页面资源加载缓慢
    
     总结:H5页面加载速度慢的原因:渲染速度慢 & 页面资源加载缓慢 导致 。
    
  2. 耗费流量 每次使用 H5页面时,用户都需要重新加载 Android WebView的H5 页面 每加载一个 H5页面,都会产生较多网络请求(上面提到) 每一个请求都串行的,这么多请求串起来,这导致消耗的流量也会越多

  3. 解决方案 两种解决方案:

     使用Android WebView 自身的缓存机制
     自身构建缓存机制(主要是H5页面资源的预加载)
    

androidwebview's People

Contributors

nanos-11 avatar

Stargazers

 avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.