Tuesday, August 6, 2013

My Javascript to Guess Processor's Speed

Updated on 5th of February, 2014: There is an updated version for this posting here.

This is necessary when your web page runs a lots of animation using javascript. If the target browser is slow in computing speed, it is advisable to reduce the amount of animation to run on the machine.

Here's my simple way to check the speed of a computer using simple Javascript:


var count;
var d = new Date();
var startTime = d.getTime();

for (i=0; i<=1000000; i++) {

var d = new Date();
var endTime = d.getTime();
var myLatency = endTime - startTime;


myLatency contains my speed index.

After testing using this script, iPad 1 will give myLatency more than 200, iPad 2 between 100 and 200, and iPad 3/4 less than 100.

As for the PC/Mac, myLatency is around 20-100 for dual core processor and quad core processor less than 10. Anyway, the myLatency also depends on the tasks the computer is running in the background concurrently and the core speed in GHz. Anyway, it is just a guess speed Javascript and it should not be treated as a sure thing for the speed test.

No comments:

Post a Comment