diff options
Diffstat (limited to 'chrome/test/data/read_cookies.html')
-rw-r--r-- | chrome/test/data/read_cookies.html | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/chrome/test/data/read_cookies.html b/chrome/test/data/read_cookies.html new file mode 100644 index 0000000..b457c34 --- /dev/null +++ b/chrome/test/data/read_cookies.html @@ -0,0 +1,35 @@ +<html> +<body> +<pre> +<script> + +// This script tests the performance of reading cookies. It sets a cookie and +// then reads cookies N times. Finally, it outputs the average time taken to +// read the cookie. + +document.cookie = + 'one_heck_of_a_crazy_cookie_name=1234567890.1234567890.1234567890.1234567890'; + +var ok = true; + +var num_iters = document.location.search.substring(1) - 0; +if (num_iters == 0) + num_iters = 10000; +document.writeln("num_iters: " + num_iters); + +var ts = (new Date()).getTime(); + +// read the cookie num_iters times +for (var i = 0; i < num_iters; ++i) { + var d = document.cookie; +} + +var te = (new Date()).getTime(); + +var time_per_read = (te - ts) / num_iters; +document.writeln("time per read: " + time_per_read.toFixed(3) + " msec"); + +</script> +</pre> +</body> +</html> |