- Less Server Influence.
- Increase in Interactivity.
- Instant feedback to the Visitors.
- Affluent Interfaces.
- Good versatility.
- It is cost-effective.
1. Learning asynchronous programming
2. Keeping your code small and light
It is very important that one must keep the code as light as possible, to maintain that high performance of Mobile Applications. Keeping code light and compact reduces the inertness and boosts up the speed. By shrinking and decreasing different JS files into one is one more method for optimization of application’s performance.
3. Describe variables locally
Variables usually are used to describe the functions which are stored inside. Variables are of two types, local variables and global variables.
Variables which are described only within themselves are nothing but a Local Variable. Variables which are used throughout the Script are known as Global Variable. If one describes most of the Variables locally then there will b a quick reduction in the time needed by the engine to hunt them. Thus it will increase the overall speed of the application.
4. Event Deputation Execution
It is easy with Event Deputation to use a single event handler which at the end of the day helps in well organized management of a type of event for the entire page. Large web Applications can stop because of the presence of various event handlers and the absence of Event Deputation. Advantages of Event Deputation are; low functionality to run, less memory needed to process and hardly any ties between DOM and CODE.
5. Avoid undesirable loops
6. Gzip compression
7. Reduce DOM access :
8. Boosting performance using caching object
9. Specifying the implementation context
10. Make use of Semicolons for termination of the line
11. Create a Self-calling Function
It is usually termed as a Self-Invoked Anonymous function or Immediately Invoked Function Expression (IIFE). It is a function which accomplishes automatically when you Create it.
12. Avoid using ()
Making use of () inserts a Variable at global scope and hence, if the other Variable has the same name; then it can give rise to the confusion and overwriting of the value.
13. Avoid using try-catch- finally inside a loop
The try-catch-finally construct develops a new Variable in the latest scope at runtime each time the catch clause is implemented; where the caught exception object is allocated to a Variable.
14. Deal with WebSocket Time out
Basically, when a WebSocket connection is accustomed, a server can time out your connection after 30seconds of inactivity. To deal with timeout problems you can send an empty message to the server intermittently. To carry out this, add these two functions to your code: one for keeping your connection alive and the other one to cancel the keep alive. By using this you can easily control the timeout.