Data storage-High performance JavaScript

Source: Internet
Author: User
1. How data is stored

1. Literal

2. Variables

3. Array items

4. Object Members

2. Respective performance characteristics

1. The fastest access to literals and local variables, and relatively slow access to array items and object members

2. Because local variables start at the scope chain, accessing local variables is faster than accessing cross-scope variables. The deeper the variable is located in the scope chain, the longer it will be accessed.

3. Avoid using the WITH and Try-catch statements because he will change the scope chain and affect performance.

4. Nested object members can significantly affect performance.

5. The deeper the properties and methods are located on the prototype chain, the slower the access is.

6. You can save common object members, array elements, and cross-domain variables in local variables to improve performance.

Data storage-High performance JavaScript

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.