Created
June 18, 2010 19:41
-
-
Save longouyang/444107 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<script type="text/javascript"> | |
var pID; | |
var i = 0; | |
var startTime, endTime; | |
function start_test() { | |
i = 0; | |
pID = setInterval(update, 1); | |
startTime = new Date(); | |
} | |
function update() { | |
i++; | |
if(i == 250) { | |
end(); | |
} | |
} | |
function end() { | |
clearInterval(pID); | |
endTime = new Date(); | |
document.getElementById('result').innerHTML = (endTime-startTime) / 250 + "ms"; | |
} | |
</script> | |
</head> | |
<body> | |
This test assesses how fast setInterval() is called. | |
<input type="submit" onclick="start_test();" value="Start"> | |
<div id='result'></div> | |
</body></html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment