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.
Choose the most suitable technology
The choice of technology is key to optimizing resources; choose the most eco-friendly tool that fits the purpose and meets all the needs.
Here are the five largest families of solutions available, in descending order of eco-friendliness. - Static website (created with specialist software such as Dreamweaver, or a code editor) - Generated website (e.g. using Jekyll, a tool in Ruby that, amongst other things, can process templates and construct permalinks) - Custom-built dynamic website (with PHP, J2EE, .NET, etc.) - Custom-built dynamic website using a framework (such as Symfony) - Dynamic website developed using a CMS (such as Drupal, Joomla!, Jahia, etc.). The more the solution is ‘packaged’, the more abstraction layers are stacked, hampering performance.