Oracle Magazine Special offer for AjaxImpact.com Visitors!! Subscribe to Oracle Magazine for Free!
AJAX IMPACT



AJAX NEWS
Way to improve performance when using JavaScript String class in an Ajax environment
03/25/2006, By Ajax Impact News



Over Captian's blog there is an intresting analysis regarding the use of JavaScript String class, that will be usefull when developer code in an Ajax environment. He have done the comparision in three way on use of string.

After analysis it was found that the difference is amazing, the code executes in 90 milliseconds, almost 30 times as fast as the original code!

He writes " About 6 or 7 years ago when I was doing Ajax like development before it was the fashionable thing to do (and everyone told me I was nuts) I ran into performance problems on the client due to the large number of string concatenations that were required to render the data to the screen.

Unfortunately JavaScript does not offer the same powerful classes like Java's StringBuffer and dotNet's StringBuilder so I had to be a bit creative and come up with a workaround.

So what is the magic ingredient? The StringBuilder class encapsulates a simple JavaScript array. Every time a string is added to this array the size of the array is increased by 1, a relatively fast operation. The string is not even copied but a reference to the string is added to the array, which again is a very fast operation. When we need the full string (the toString() method) then we let the system do all the work by calling arrayName.join(""), which takes about 10 milliseconds.

This code is used on several major e-commerce sites and has made the difference between being sluggish and being very fast. The difference is even more apparent on slower systems.

Watch the complete demo examples here as well as Download complete code for this example.

   Want to read more... Click here


 Rate this Ajax News
 Rating: 0.0 out of votes cast

AJAX NEWS
04/01/2007 wxJavaScript : porting wxWidgets to JavaScript.
03/31/2007 DED|Chain - The web developers JavaScript Kit
03/30/2007 Clipperz Crypto Library - a JavaScript library of crypto primitives
03/28/2007 ETech - AJAX Unplugged Slides
03/27/2007 Stripe Generator: ajax powered web 2.0 tool!
03/26/2007 Finally Microsoft joins the OpenAjax Alliance


INDUSTRY NEWS
05/19/2006 Ajax grabs center stage at JavaOne, By Tony Baer
05/15/2006 Oracle to boost AJAX, Java , By Paul Krill
05/13/2006 Open AJAX Group Drafts Development Plans, By Stacy Cowley
05/13/2006 AJAX Powers Interactive Marketing ASP, By AjaxWorld News Desk
05/12/2006 AJAX Experts Tackle Security, Other Issues , By Darryl K. Taft
05/11/2006 Adobe Releases Spry Framework for AJAX, By AjaxWorld News Desk
More 
       

      © 2008 ajaximpact.com. All rights reserved.