Watch Our YouTube Channel
It is currently Sat Dec 16, 2017 5:04 am
 

All times are UTC



Post new topic Reply to topic  [ 1 post ] 
Author Message
PostPosted: Thu Apr 23, 2015 10:48 am 
Offline

Joined: Wed Feb 25, 2015 9:44 am
Posts: 82
Reduce Activity in Loops
Loops are often used in programming.Each statement in a loop, including the for statement, is executed for each iteration of the loop.Search for statements or assignments that can be placed outside the loop.Use this code.
Code:
l= arr.length;
for (j = 0; j < l; j++) {

Reduce DOM Access
Accessing the HTML DOM is very slow, compared to other JavaScript statements.
Reduce DOM Size
Keep the number of elements in the HTML DOM small.This will always improve page loading, and speed up rendering (page display), especially on smaller devices.
Avoid Unnecessary Variables
Don't create new variables if you don't plan to save values.
Avoid Using with
Avoid using the with keyword. It has a negative effect on speed. It also clutters up JavaScript scopes.
The with keyword is not allowed in strict mode.
Delay JavaScript Loading
Putting your scripts at the bottom of the page body, lets the browser load the page first.
While a script is downloading, the browser will not start any other downloads. In addition all parsing and rendering activity might be blocked.
If possible, you can add your script to the page by code, after the page has loaded.

_________________
S.Ramya
Choose your Apple watch
Read Latest Technology News


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron