Cordova/phonegap/webapp Performance Optimization method

Source: Internet
Author: User

Do a few Cordova project, think WebApp performance is really not comparable to native, on iOS Fortunately, Android on the special obvious. Technology group many people are saying that Cordova is a slag, useless and so on. Actually just a lot of people did not go deep to understand, do little optimization, General additions and deletions to check the app or fully meet the performance requirements.

1. You can make your own UI, do not use the framework. Do not use jquery mobile with Sencha Touch or Jqmobi (app framework)

2. Do not generate the UI on the server, generated locally.

3. The front end is inserted as few as possible on the DOM, removing the displayed elements.

4. Turn off the page switching effect, which is how many white screen on Android appear.

5. Avoid network requests, can be saved locally with Localstorage,sqlite database, files, etc.

6. Use a local cache for the data, such as an AJAX-enabled cache.

7. Limit the height and width of the result set

8. do not let the interface and other data, load the interface, and then load the data . such as CSS and HTML write before, JS write back. Ajax async and so on.

9. All animations with CSS conversion and hardware acceleration, performance will be much better.

10. Use the local scroll bar, with plug-in words, card out Xiang!

{    overflow: auto;     -webkit-overflow-scrolling: touch;     position: absolute;     top: 48px;     Bottom: 0px;     Left: 0px;     right: 0px;}

11. Avoid using the Click Trigger, because there will be a delay of 300 milliseconds, triggered directly with touch.

12. Optimize the image for each element to set a picture of the SRC is very slow. Directly with CSS Sprite Sheets, in many pictures of the app inside the effect is obvious.

13. The size of the image should match the HTML container.

14. Do not use shadows and gradients, especially on Android phones, the cost of shadow rendering is too great. Other text alignment and boundary radii are also available.

15. Reduce reflux. Reduce the number of DOM, reduce DOM access, avoid using JS to adjust the layout, all with CSS to complete.

16. Useless framework, do not silly full reference come in, figuring out what you need, do not need to load, loading is time, especially in the mobile browser, particularly obvious.

17. Use developer tools to debug, see what takes up the most time, and then optimize for purpose.

Cordova/phonegap/webapp Performance Optimization method

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.