Click here to Skip to main content
Click here to Skip to main content

Simple Browser Iteration Test

By , 25 Mar 2009
 

Introduction

There is a big battle out there about Internet Browsers! Everyone says their browser is the best and fastest. I think this is the time that we CodeProject guys should start to create our test tools and not listen to what ads say.

I am not a professional tester in this case. As a web developer, my first concern is the iteration speed. For this purpose, I have created a kid-level HTML page to iterate 10,000 times and add a simple text to a text area within the page:

<html>
<head>
 <title>Simple Browser Iteration Test</title>
</head>
<body>
 <textarea id="text" style="height: 300px;" cols="80" rows="20"></textarea>
 <script language="javascript" type="text/javascript">
  var t = document.getElementById("text");
  var d1 = Date();
  for (var i = 0; i < 10000; i++) {
     t.value += i.toString();
  }
  var d2 = Date();
  document.write("<br />" + d1 + "<br />" + d2);
</script>
</body>
</html>

As you can see, it is really simple and does not need any extra explanation.

The following are the results of running this page on my machine in different browsers:

1. IE8-64bit: ~6 sec

IE8-64bit.png

2. IE8-32bit: ~7 sec

IE8-32bit.png

3. Chrome 1.0.154.53: ~12 sec

Chrome.png

4. FireFox 3.0.7: ~4min and 56sec

FireFox.png

I think you got the main idea. I request to create an Open Source project here to work on Browsers in real action tests in which everyone can check their code and make any suggestions. It would help to find out the reality, not what vendors say!

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Tecfield
Software Developer (Senior)
United States United States
Member
I got my BS in Software Engineering from Iran, worked there for 4.5 years mainly in industrial automation field. Then I moved to Australia. In Australia, I had a great chance to work at some big companies. Since 2009 I have been living in the States. I received my MS in Information Systems from Illinois State University. Currently, I am a Senior Software Development Engineer.

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
QuestionHardware?memberDanila Korablin30 Mar '09 - 2:51 
You forget to mention about used hardware, running software etc.
On one of my test machine your test script is executed more than one minute (FF 3.x).
 
Wormhole is the God divided by zero

AnswerRe: Hardware?memberTecfield30 Mar '09 - 14:59 
I mentioned it indirectly! I said I ran the test for all those browsers on the same machine. So, the comparison should be OK.
But if you want to know more about my machine hardware, it is:
- 4GB 1066MHz DDR3 Dual Channel Memory
- P8400 (2.26GHz, 1066MHz FSB, 3MB L2 Cache)
- Microsoft® Windows Vista® Home Premium (64-bit) with SP1
 
If you need more info let me know
 
Maybe I, Maybe U, can make a change to the world!

Generalsomehow I do not care which one is fastest browsers.memberGevorg28 Mar '09 - 4:53 
Me, as a developer, simply do not care which one is faster.
So what that Safari is fastest? Until IE has 70% of the market and Firefox has 25% of the market.
All I care is that my application works with IE and FireFox. Even if those two are be slowest, buggiest browsers that exists ( I exaggerated here just to make my point).
And I do not care about Safari, Netscape, Opera....
 

George.
 
My site - Body Jewelry
Not my site - Piercing info

GeneralRe: somehow I do not care which one is fastest browsers.memberTecfield29 Mar '09 - 3:17 
That's a good point! Shucks | :-> Wink | ;)
 
Maybe I, Maybe U, can make a change to the world!

GeneralSafari got hole process in just 3 sec nicememberkru27 Mar '09 - 0:50 
I am upset that u don't show the test on the safari browser because the safari is the best performer of the java script
Though,Safari got hole process in just 3 sec nice so is it safari is clearly the unchallenged winner,is it?????????????????????????Confused | :confused: Confused | :confused: Confused | :confused: Confused | :confused: Confused | :confused: Big Grin | :-D Big Grin | :-D Big Grin | :-D Big Grin | :-D Big Grin | :-D Big Grin | :-D Big Grin | :-D
GeneralRe: Safari got hole process in just 3 sec nicememberTecfield27 Mar '09 - 19:39 
Hi there,
Safari is not one of the major browsers. That's the reason I didn't run the test on it Smile | :)
Anyways, by this article I didn't want to say which browser is the winner! I wanted to say it is the time we build our own test tools to check the reality.
 
Thanks
 
Maybe I, Maybe U, can make a change to the world!

GeneralIE , Firefox TablememberMember 400479926 Mar '09 - 21:26 
for a best purpose you can try iteration with nested table. There is a big differences between IE and Firebox
GeneralRe: IE , Firefox Table [modified]memberTecfield29 Mar '09 - 3:15 
I tested that. FireFox done by 5 secs. IE and Chrome both finished by 2 secs.
Here is the code I used:
 
<html>
<head>
	<title>Test</title>
</head>
<body style="font-family: Arial; font-size: 12pt;">
	<div>
		<table cellpadding="5px" cellspacing="0px">
			<tbody>
				<tr style="background-color: #DDDDFF;">
					<td style="text-align: right">
						Start Time:
					</td>
					<td id="startTime" />
				</tr>
				<tr style="background-color: #DDFFDD;">
					<td>
						End Time:
					</td>
					<td id="endTime" />
				</tr>
			</tbody>
		</table>
		<div style="height: 200px; overflow: auto; background: #DDDDDD; border: solid 2px #AAAAFF;">
			<table cellpadding="5px" cellspacing="0px" id="data" width="300px" style="text-align: center;">
				<tbody />
			</table>
		</div>
 
		<script language="javascript" type="text/javascript">
			var da = document.getElementById("data");
			var d1 = Date();
			for (var i = 0; i < 10000; i++) {
				var td = document.createElement("TD");
				td.innerHTML = i.toString();
				td.style.borderBottom = "dotted 1px #888888";
				td.style.backgroundColor = i % 2 ? "#AAAAFF" : "#AAFFAA";
				da.insertRow(-1).appendChild(td);
			}
			var d2 = Date();
 
			document.getElementById("startTime").innerHTML = d1;
			document.getElementById("endTime").innerHTML = d2;
		</script>
 
	</div>
</body>
</html>

 
Maybe I, Maybe U, can make a change to the world!
modified on Sunday, March 29, 2009 9:22 AM

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Permalink | Advertise | Privacy | Mobile
Web01 | 2.6.130523.1 | Last Updated 25 Mar 2009
Article Copyright 2009 by Tecfield
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid