Home Articles FAQs XREF Games Software Instant Books About Feedback Search Site-Map
irt.org logo

Q1150 How can I find out how fast someones computer is?

irt.org | Knowledge Base | JavaScript | Misc | Q1150 [ previous next ]

Q1150 How can I find out how fast someones computer is?

A possible approach is to see how quickly you can get the setTimeout() function to return.

The setTimeout() function accepts to parameters:

timer = window.setTimeout(code, delay);

where code is to be evaluated in delay number of milliseconds.

Normally the smaller the number of delay milliseconds the more unreliable the interval is - I suspect that the higher the processor speed and the less loaded the processor is then the interval decreases.

You could test the interval with something like:

<script language="JavaScript"><!--
function myFunction() {
    var date2 = new Date();
    alert('interval = ' + (date2.getTime() - date1.getTime()) + ' milliseconds');
}

var date1 = new Date();
setTimeout('myFunction()',0); // no delay
//--></script>

Which on my machine (P133, GNU/Linux, Netscape Navigator 4.5) shows 56 milliseconds.


Provide feedback ...
AddThis Social Bookmark Button

Provide feedback ... AddThis Social Bookmark Button


Last Updated: 30th March 2008. Maintained by: Martin Webb and Michel Plungjan
irt.org liability, trademark, document use, privacy statement and software licensing rules apply.
Copyright © 1996-2008 irt.org, All Rights Reserved.