6 // This script tests the performance of reading cookies. It sets a cookie and
7 // then reads cookies N times. Finally, it outputs the average time taken to
11 'one_heck_of_a_crazy_cookie_name=1234567890.1234567890.1234567890.1234567890';
15 var num_iters
= document
.location
.search
.substring(1) - 0;
18 document
.writeln("num_iters: " + num_iters
);
20 var ts
= (new Date()).getTime();
22 // read the cookie num_iters times
23 for (var i
= 0; i
< num_iters
; ++i
) {
24 var d
= document
.cookie
;
27 var te
= (new Date()).getTime();
29 var time_per_read
= (te
- ts
) / num_iters
;
30 document
.writeln("time per read: " + time_per_read
.toFixed(3) + " msec");