1. Use HTTP/2-
2. Use pointer references-
You can also slow down on DOM traversal trips by storing pointer references for in-browser objects throughout instantiation. If you don’t expect your DOM to change, storing regard to the DOM or jQuery objects required to make your page will help speed everything along. alternatively, if you would like to iterate inside a function, but you haven’t keep a reference, you'll create a local variable with a respect to the object.
3. Trim your HTML-
The complexness of your HTML plays a large role in determining how long it takes to query and modify DOM objects. If you'll cut your application’s HTML by half, you may probably double your DOM speed. That’s a tricky goal, however, you'll begin by eliminating unnecessary div and span tags.
4. Use document.getElementById()-
Using jQuery allows you to create specific selectors based on tag names and classes, however, this approach necessitates many iterations as jQuery loops through DOM elements to search out a match. you'll speed up the DOM by using the document.getElementById() methodology instead.
5. Batch your DOM changes-
Every time you create DOM changes, batch them up to prevent recurrent screen rendering. If you’re creating style changes, try to create all of your modifications at once instead of applying changes to every style on an individual basis.
6. Buffer your DOM-
If you have scrollable DIVs, you'll use a buffer to get rid of items from the DOM that aren’t presently visible within the viewport. this system helps you save on each memory usage and DOM traversal.
7. Compress your files-
8. Limit library dependencies-
Library dependencies add a lot to loading times, thus try to keep their use to a minimum, and avoid them entirely if in the least attainable. one way to cut back your dependency on external libraries is to rely additional on in-browser technology.
Furthermore, if you would like complex CSS selectors, try using Sizzle.js rather than jQuery. If you've got libraries that contain only one feature, it makes additional sense to just add that feature severally.
9. Minify your code-
10. Add post-load dependency managers-
Adding a dependency manager, like RequireJS or web pack, to your load scripts lets the user see your application’s layout before it becomes useful. this could have an enormous positive impact on conversions for first-time guests. simply certify your dependency manager is set up to trace that dependencies have already been loaded, instead, an equivalent library might load twice. always aim to load the absolute minimum the user must see.
11. Cache as much as you can-
Caching is your greatest plus for speeding up load times. make sure you leverage browser caching as well as intermediary caching mechanisms like a content delivery network. this can make sure that your assets load quickly each for previous guests in addition as first-time guests.
12. Mind your event handlers-
Since events like ‘mousemove’ and ‘resize’ execute many times per second, pay special attention to any event handlers sure to those events. If they take over 2-3 milliseconds to finish, you would like to higher optimize your code.
13. Replace ‘click’ with ‘mouseup’-
Binding actions on the ‘mouseup’ event instead of click event, that fires before the ‘click’ event, provides a performance boost by ensuring that no interactions are lost if the user makes several mouse clicks in speedy secession.
14. Use reference types responsibly-
While primitive value types like strings and integers get traced each time they're passed into a brand new function, reference types, like arrays and objects, are passed as light-weight references. Therefore, you'll do things like pass DOM node references recursively to chop down on DOM traversal. Also, bear in mind that examination strings always takes longer than examination references.
16. Use the local scope (‘this’)-
Speaking of which, this permits you not only to write asynchronous code with callbacks, however, it additionally helps boost performance by reducing dependency on global variables or closures residing higher within the scope chain. Conversely, you must avoid them with the keyword as a result of it modifies the scope chain, that drags down performance. you'll wire the scope variable using the call() and apply().
17. Favor native functions and constructs-
Rather than writing your own algorithms or relying an excessive amount of on host objects, the benefit of native functions and constructs the maximum amount as you'll. ECMAScript lists many native constructs for you to decide on from.
18. Prefer Async and Defer-
If you wish script tags to load asynchronously or to defer till the rest of the page has finished loading, you'll add the async or defer attributes.
19. Animate with requestAnimationFrame-
20. Throttle and Debounce-