Although event handlers can add strong interactive capabilities to modern Web pages, it is absolutely foolish to add a large number of event handlers indiscriminately. Let’s analyze it: an event handler is essentially a function and an object, which is stored in memory. Setting a large number of event handlers will increase the number of objects in the memory, and the performance of the Web program will become worse and worse. Poor, the user experience is very bad. In order to make better use of event handlers, event delegation appeared to improve performance. Event delegation Event delegation: Bind the processing functions of the same event on several child nodes to its parent node, and uniformly process the events that bubble up from the child nodes on the parent node. This technology is called events delegate. To add: event delegation is not limited to parent nodes and child nodes. You can also play like this. For example, there are many buttons in different positions in the page document, all of which are bound to click events. Using event delegation, we can bind these events to the body element and then process them (although generally Rarely used). The following examples step by step illustrate the advantages of event delegation
1. Detailed introduction to the impact of JavaScript events on memory and performance
Introduction: Although event handlers can add strong interactive capabilities to modern Web pages, it is absolutely foolish to add a large number of event handlers indiscriminately. Let’s analyze it: an event handler is essentially a function and an object, which is stored in memory. Setting a large number of event handlers will increase the number of objects in the memory, and the performance of the Web program will become worse and worse. Poor, the user experience is very bad. In order to make better use of event handlers, event delegation appeared to improve performance. Event delegation Event delegation: Put the same thing on several child nodes...
2. Summary of new features and deprecated functions in PHP 5.4
Introduction: Summary of new features and deprecated functions in PHP 5.4: 1. New features of PHP5.4 1. Memory and performance improvements: 20-50% memory savings in large PHP applications. Improve performance by 10-30% through various optimizations 2. Support Trait 3. Simplified array syntax, allowing you to define short arrays 4. Function array dereferencing, supporting Array dereferencing, 5. Instance method call 6. Closure binding 7. Objects are functions 8. Built-in We
Introduction: PHP5.4 latest features official website: ChangeLog-5.php#5.4.0 Original Oracle: There is new competition in the LAMP system, but the features in this version push PHP to the limits again. Slightly modified. : Overview summary: 1. Memory and performance improvements: 20-50% memory savings in large PHP applications. Improve performance by 10-30% through various optimizations 2. Support Trait 3. Simplified array language
4. About the performance of php framework ci
Introduction: Is it okay to use the framework? The performance is very poor. Why do I output a hello world? Without the framework, I can respond to 2000 requests per second, but with CI, I can only respond to 400 requests. Since the framework consumes machine memory and performance like this, why does everyone still use the framework?
[Related Q&A recommendations]:
About the performance of php framework ci
javascript - Forum How do websites like this generally use pagination?
The above is the detailed content of Detailed introduction to memory and performance. For more information, please follow other related articles on the PHP Chinese website!