Keep DOM access via JavaScript to a minimum
Accessing the DOM (Document Object Model) via JavaScript is a heavy process that uses a lot of processor power (CPU). Minimize this type of access as much as possible.
To do so, you can assign a node to variables that you will repeatedly use in the application’s lifecycle, which avoids traversing the tree each time the document is manipulated.
Libraries such as ‘Shadow DOM’ can also be used to optimize the tree though a batch system.
Check JavaScript code
JSLint is a JavaScript code quality tool that checks that the JavaScript syntax used will be understood by all browsers.
The code produced thus complies with coding rules which enables interpreters to quickly and easily run the code. The CPU is therefore utilized for a shorter time.