JavaScript optimization topic-LoadingandExecution loading and run_javascript skills

Source: Internet
Author: User
This article mainly introduces the loading and running of LoadingandExecution in the JavaScript optimization topic. if you are interested, refer to the performance of JavaScript in the browser, it can be considered as the most important availability issue for developers. This problem is complicated due to the blocking feature of JavaScript, that is, when JavaScript is running, other things cannot be processed by the browser. In fact, most browsers use a single process to process multiple tasks, such as UI update and JavaScript running. at the same time, only one task can be executed.

How long does JavaScript run? how long is the waiting time before the browser is idle and responds to user input.

Basically speaking, this means that the appearance of the script tag makes the entire page wait for parsing and running the script. No matter whether the actual JavaScript code is inline or contained in an unrelated external file, the page download and parsing process must be stopped and wait until the script completes the processing before it can continue. This is an essential part of the page lifecycle, because the script may modify the page content during running.

A typical example is the document. write () function, for example:

Script Example

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.