Javascript high-performance programming-improves data access speed and javascript high-performance
HasOwnProperty () Only retrieves instances without retrieving prototypes. in is the retrieval instance. The deeper the prototype member nesting, the slower the access speed. It only uses Object members when necessary. If you want to read the same object attribute multiple times in the same function, it is best to store it into a local variable. Replace attributes with local variables to avoid performance overhead caused by extra attribute searches. Direct Volume and local variable access speed is very fast, and it takes longer for Array items and object members. Local variables are faster than external variables because they are located in the first object of the scope chain. The deeper the location of a variable in the scope chain, the longer the access time. Global variables are always the slowest, because they are always at the end of the scope chain. Avoid using the with expression because it changes the scope chain of the runtime context. Also, you should be careful with the catch clause of the try-catch expression, because it has the same effect as nested object members will have a major performance impact and should be used as little as possible. In general, you can improve the performance of JavaScript code by storing frequently used object members, array items, and out-of-domain variables into local variables. Then, accessing local variables is faster than those of the original variables.