Because event handlers can provide interactivity for modern WEB applications, many developers are indiscriminately adding a large number of handlers to the page. In JavaScript, the number of event handlers added to the page will directly affect the overall performance of the page. The causes of this problem are manifold. First, each function is an object, consumes memory, and the more objects in memory, the worse the performance. Second, you must specify the number of DOM accesses that are caused by all event handlers beforehand, delaying the interaction readiness time of the entire page. There are some ways to improve performance from the perspective of how to use the good event handlers.
Events are often triggered by user actions or by other browser features. But few people know that you can use JavaScript to trigger specific events at any point in time, and events like browser-created events.
The following is a summary of memory and performance, simulation events in JavaScript Advanced programming:
Memory and performance in JavaScript, simulation events (mind mapping for reading notes)