javascript运行效果测试
抽空写的一个验证JS在浏览器之间的奔跑速度测试: FF和chrome遥遥领先啊.....
< !DOCTYPE html > < html > < head > < meta charset = "utf-8" / > < title > js运行效率测试 < / title > < / head > < body style = "overflow:hidden;" > < script > var s = function (m) { return document.write(m) } var list = []; var count = 10; function getAverageTime() { var t = new Date().getTime(); var i = 10000; while (i > 0) { i--; s(i); } var r = new Date().getTime() - t list.push(parseInt(r)); if (count > 0) { count--; getAverageTime(); } } getAverageTime(); var total = 0; for (var n in list) { total += list[n]; } s("<br/>浏览器 [" + navigator.appName + "] 输出10000个数字的平均需要的时间: " + + total / 10 + "毫秒"); < / script > < / body > < / html >