JavaScript performance Optimization (2)

Source: Internet
Author: User

1. Image loading effect. Browsers choose different rendering algorithms based on different images.

1.1 wavelet algorithm: First blur and then clear. This loading method is faster and improves rendering performance. The disadvantage is that more memory is consumed. If it is a large size picture, you can use this method.

Export images from PSD, stored as Web format, JPEG tick continuous, PNG tick interleaved, so the exported image is from blur to clear.

1.2 Discrete cosine transform: row-by-line loading shows clear images

2. Common Video Optimization methods

2.1 UI Requirements for custom players (slightly)

2.2 Video is loaded first, shortening the time from the user entering the page to the first frame of the video playback.

2.2.1 Regardless of where the initialization file is located, the browser will always default to loading the multimedia file resource last. So, cheat the browser and load the multimedia resource as a style sheet:

<ref= "stylesheet"  type= "text/css"  href= " xxx.swf ">

3. Leveraging front-end caching technology

3.1 Sessionstorage-as the label turns off auto-recycle (empties the cache), you cannot interact across pages.

3.2 UserData-storage limits are too small, each file is less than 128kb, and a total of 1024kb files can be saved under a domain name. At restricted sites, a single file 64kb, a total of 640kb.

3.3 Cookies-good compatibility. Size is limited, each time a request is sent, the request header will be sent with a cookie.

3.4 OpenDatabase-is the complete database.

3.5 Localstorage-There is no time limit for stored data.

JavaScript performance Optimization (2)

Related Article

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.