Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: e4000ce7f9
Fetching contributors…

Cannot retrieve contributors at this time

29 lines (27 sloc) 0.94 kb
<html><head><title>Cookie Test</title>
<script>
function cookieTest(){
var totalW = 0.0;
var totalR = 0.0;
var numLoops = 100;
for(var i=0; i < numLoops; i++){
var randomNumber=Math.floor(Math.random()*11);
var time = new Date();
time.setTime(time.getTime() + 1000);
var cookieString = "cookie" + randomNumber + "=true; expires=" + time.toGMTString();
var preW = new Date().getTime();
document.cookie = cookieString;
var postW = new Date().getTime();
if(document.cookie.indexOf(("cookie" + randomNumber)> 0));
var postR = new Date().getTime();
totalW += (postW - preW);
totalR += (postR - postW);
}
document.write("<br><br>avg R(millis):" + totalR/numLoops);
document.write("<br>avg W(millis):" + totalW/numLoops);
}
</script>
</head>
<body onload="javascript:cookieTest();setTimeout(cookieTest(), 1000);">
</body>
</html>
Jump to Line
Something went wrong with that request. Please try again.