Google Chrome浏览器js引界面擎渲染能力测试,惊人!!
google浏览器刚出来,性能究竟如何呢,偶写了一个小程序通过dom的方式渲染一个5000行10列数据的表格,测试结果如下
Google Chrome: 1482 ms IE 7.0 : 17547 ms Firefox 2.0: 5047 ms
可以看到google的js脚本渲染界面能力比IE快10倍,比Firefox快3倍,性能非常惊人。Google Chrome的Javascript engine基于V8引擎的,js源代码直接生成了机器码,只需要解释一次,其他浏览器如 IE Firefox都是反复多次解释执行的。 可以预见现在众多ajax框架有了google浏览器后,性能问题可以得到很大提升了,对ajax框架无异于是个大利好,加油,google chrome。
有没有测试过对img缩放...chrome会很慢...google maps在chrome下干脆取消了缩放效果(或者说只有一步)
测试代码如下
// 创建和元素 mytable = document.createElement("table"); mytablebody = document.createElement("tbody");
//创建所有的单元格 for(var j = 0; j < 5000; j++) { // 创建一个 元素 mycurrent_row = document.createElement("tr");
}
// 把 添加到 mytable.appendChild(mytablebody); // 把 添加到 mybody.appendChild(mytable); // 把mytable的border属性设置为2; mytable.setAttribute("border","2"); var end = new Date(); var forLoopTime = end-start; var textElem = document.createTextNode(forLoopTime + 'ms ') document.getElementById('forResult').appendChild(textElem);
}