Take advantage of caching to improve performance. You can have scripts that access a particular object multiple times. You can leverage caching by storing a repeatedly accessed object inside a user defined variable. Then you can use this variable instead of subsequent references to the object. The following code snippet shows how you can achieve this.
Minimize DOM access
Note that accessing the DOM in HTML is slow, i.e., it is a performance intensive operation. You should ensure that DOM access is at the minimum. There are many ways you can do this to reduce DOM traversal like, you can store references to the browser objects at the time of instantiation so that they can be reused at a later point of time.
Asynchronous API calls
Asynchronous programming facilitates fast and responsive user interfaces. You should take advantage of asynchrony to make asynchronous calls to the APIs. This would reduce the need of using too many worker threads and would boost the application’s performance and scalability. Asynchronous programming is complex but there are many resources available these days.
Use local variables
Ensure that your code is lean and clean
You can take advantage of Gzip compression to compress the rendered content. Note that most servers and modern-day browsers support Gzip compression. When you have a Gzip compatible browser requesting a resource from the server, the response is rendered in a compressed format thus saving on the bandwidth, time needed to render the response, etc. This greatly improves the performance of the application.