High-performance JavaScript reading notes-2

Source: Internet
Author: User

Chapter II

Data access

Literal:

Represents itself without a specific location: string number bool Object Array function Regular expression

Local variables:

Var

Array:

Stored inside the JS array object, indexed by numbers

Object Members

Stored inside the JS object as a string index

  1. There are four basic data access locations in javascript: direct volume, variable, array element (indexed by number), object member (with character bed as index)
  2. Each JS function represents an object, which is a real column of a fun object
  3. Functions are unique to each execution environment, so calling the same function multiple times will result in multiple execution environments being created
  4. Each time a variable is encountered, it undergoes an identifier parsing process to determine where to get or where to store the data, and the function method sum Num1 num2 will produce a search process that has a performance impact
  5. Accessing both the direct and local variables is the fastest, whereas accessing the array elements and object members is relatively slow.
  6. The deeper the property or method is positioned in the prototype chain, the slower it is to access it.
  7. In general, you can improve JavaScript performance by using common objects, array elements, and variables stored in local variables.

High-performance JavaScript reading notes-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.