Test CPU Speed using JavaScript

Run this code above and see how fast your processor does the math.

var startTime = new Date();
document.write(“Thinking …..”);
var i = 0, j=0;k = 0, sum = 0;
for (i = 0; i <= 1000; i++)
for (j = 0; j < 500; j++)
for (k=0;k<500;k++) {
sum = i + j + k;
}

var endTime = new Date();

var diff = endTime – startTime;
document.write("
Done “);
document.write(diff + ” milli seconds passed”);

Advertisements
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s