AJAX Made Easy - Learn AJAX

AJAX Categories

 

Latest AJAX Articles

AJAX Home AJAX-Tips

Speed up Ajax using JSMin in JavaScript

Author: admin | Published: 18th Apr 2008 | Read: 349 times | Add Comment
Filed in: AJAX Tips



JavaScript, whether in Ajax or any web development application has the tendency to be heavier even when coded at its barest. The complexity of the language always requires developers to build lines after lines of commands especially in Ajax.


When this language is paired with XML, HTTP or another language needed by developers, there is a tendency that the end product is a very heavy website that could take time to load. The culprit is not necessarily in JavaScript but with the way it is coded. Even when used in a framework, the end result could be a very heavy website that will test the patience of its intended users.


There is actually a tool that could help developers increase the speed of their application without changing the function. Called JSMin, this tool filters the coding of the application so that that application could work faster with the same functions.


Basically, this application removes all the white spaces in the application. These spaces are very small but since they are constantly seen in a website, they drag the processing of the function located in the coding of the application. By removing the white spaces, JSMin enables the developers to hasten the speed of their website or any application.


Aside from removing whitespaces in the coding of the application, JSMin also changes some characters in the coding – also with the purpose of hastening the processing of the functions in the application.  It will also change some of the things it sees unfit.


Developers can insert some characters that will signal JSMin to omit a certain coding. The following characters used to override the function of JSMin on certain parts of the application are: $ and _. By using these functions JSMin will not touch the function or the line that precedes it. Without these functions, everything that deemed unnecessary by JSMin will either be removed or changed.


On the other hand, there are disadvantages in using this application. Among them is that the coding will be a little bit harder to read or debug. The reason for this is that it changes practically everything about the coding that it does not allow the actual process to breath with whitespaces.


Those who are not familiar with JavaScript or have an advanced knowledge of the application will find it hard to read the actual coding after it is being run through JSMin. The comments in the application are also removed. Basically what is left is the actual coding in the application without any spaces, comments and in some characters in the application.


Using this application to hasten the processes in an Ajax based website is recommended. However when using this function, developers has to save the original coding before they run through the filter in the coding. This application could not be undone and if there are no copies of the coding, the developer might go back to scratch in coding. The error coding are also limited so it is best to debug the original coding first before letting it run through JSMin.






Next: Using XSLT in Ajax



Post Comment


You need to Login to post your comment...

Click here to login

Title:
 
Comment:



Daily Email Updates

AJAX Updates delivered directly to your Inbox...

Enter your email address:

Latest AJAXwith Updates
 

Related AJAX Articles

 » Degradable Ajax
 » Reducing Code Size of Ajax Applications
 » Google Hosting Ajax Libraries
 » Three Powerful Profilers for Ajax
 » Optimizing Files for Ajax
 » AFLAX - A Lightweight Ajax Framework with Flash
 » Porting MySQL Data to Ajax
 » IBM Database Connectivity for JavaScript
 » Debug your Ajax Application Easily
 » Ajax and Iphone 2.0

Popular AJAX Articles