* JavaScript Benchmarking - Part 1
Posted on July 10th, 2005 by Dave Johnson. Filed under AJAX, JavaScript, Web, XML, XSLT.
As the name suggests this is part I of a series of JavaScript benchmarking blogs. The reason for these is to investigate the performance of various Ajax programming tasks. The first entry investigates how the XSL-T processors of Internet Explorer and Firefox / Mozilla (on Windows 2000) compare and how they compare to pure Javascript code that arrives at the same end result.
So what I have done is loaded some XML and XSL for building a table structure in an HTML page. The transformation is timed and we take an average and standard deviaton for each browser. In Internet Explorer I used the Msxml2.DOMDocument.3.0 object and the XSLTProcessor in Firefox. The XSLT transformation speed is then also compared to a pure Javascript implementation. The Javascript implementation is the fastest method one can use to insert HTML into a web page [1]; a string array is used to store all the rows of the table after which the array join method is called to return a string that is inserted into the DOM using innerHTML, just as the XML/XSL approach does.
The results are somewhat surprising and can be seen below.

(note the y-axis should be in ms not s)
One can see that the XSL-T processor is Firefox / Mozilla leaves much to be desired and is no match for the Javascript method, nor is it any match for either the XSL-T or the Javasctipt method in Internet Explorer. On the other hand, the XSL-T and Javascript methods in Internet Explorer are more or less the same with a slight edge being given to the XSL-T method.
It is curious just how much variance their is on the Firefox XSL-T data. I am not sure what is causing this but all measurements were done 50 times to get the statistics and there was nothing significantly different on the system on which the tests were run.
So for the best cross-browser performance going with pure Javascript is not so bad when presenting large amounts of data to the user. Further tests will look at the performance of XSL-T and Javascript for sorting data, object and class level CSS manipulation and the recently released Google Javascript XSL-T [2] implementation.
These types of JavaScript speed issues are very important for companies like us [3] that make high performance Ajax controls and web based information systems.
[1] Quirksmode
[2] Google AJAXSLT
[3] eBusiness Applications
3 Responses to “JavaScript Benchmarking - Part 1”
Leave a Reply
Recent Posts
- BlackBerry JavaScript Oddities
- JavaScript Event Merging
- Smart Grid Utilities
- PhoneGap Desktop
- Crockford Facts
Archives
- July 2010
- June 2010
- April 2010
- March 2010
- February 2010
- January 2010
- September 2009
- August 2009
- July 2009
- June 2009
- May 2009
- April 2009
- March 2009
- February 2009
- January 2009
- December 2008
- November 2008
- October 2008
- September 2008
- August 2008
- July 2008
- June 2008
- May 2008
- April 2008
- March 2008
- February 2008
- January 2008
- December 2007
- November 2007
- October 2007
- September 2007
- August 2007
- July 2007
- June 2007
- May 2007
- April 2007
- March 2007
- February 2007
- January 2007
- December 2006
- November 2006
- October 2006
- September 2006
- August 2006
- July 2006
- June 2006
- May 2006
- April 2006
- March 2006
- February 2006
- January 2006
- December 2005
- November 2005
- October 2005
- September 2005
- August 2005
- July 2005
- June 2005
- May 2005

May 3rd, 2006 at 12:47 pm
You mentioned:
“The Javascript implementation is the fastest method one can use to insert HTML into a web page [1]”
and quoted [1].
However, the quoted document on quirkmode doesn’t mentioned any javascript at all.
May 6th, 2006 at 12:38 am
Javascript method meaning the one where he concats the string to insert using Javascript and then uses innerHTML to get it into the DOM.
June 25th, 2006 at 2:45 pm
I think, that computers so fast, that you can’t feel difference between browser’s speed.