[翻译]High Performance JavaScript(030)
第十章 Tools 工具
Having the right software is essential for identifying bottlenecks in both the loading and running of scripts. A number of browser vendors and large-scale websites have shared techniques and tools to help make the Web faster and more efficient. This chapter focuses on some of the free tools available for:
当确定脚本加载和运行时的瓶颈所在时,合手的工具是必不可少的。许多浏览器厂商和大型网站分享了一些技术和工具,帮助开发者使网页更快,效率更高。本章关注于这些免费工具:
Profiling 性能分析
Timing various functions and operations during script execution to identify areas for optimization
在脚本运行期定时执行不同函数和操作,找出需要优化的部分
Network analysis 网络分析
Examining the loading of images, stylesheets, and scripts and their effect on overall page load and rendering
检查图片,样式表,和脚本的加载过程,汇报它们对整个页面加载和渲染的影响
When a particular script or application is performing less than optimally, a profiler can help prioritize areas for optimization. This can get tricky because of the range of supported browsers, but many vendors now provide a profiler along with their debugging tools. In some cases, performance issues may be specific to a particular browser; other times, the symptoms may occur across multiple browsers. Keep in mind that the optimizations applied to one browser might benefit other browsers, but they might have the opposite effect as well. Rather than assuming which functions or operations are slow, profilers ensure that optimization time is spent on the slowest areas of the system that affect the most browsers.
当一个特定的脚本或应用程序没有达到最优状态时,一个性能分析器有助于安排优化工作的先后次序。不过,因为浏览器支持的范围不同,这可能变得很麻烦,但许多厂商在他们的调试工具中提供了性能分析器。有些情况下,性能问题可能与特定浏览器
相关文档:
AJAX (异步 JavaScript 和 XML) 是个新产生的术语,专为描述JavaScript的两项强大性能.这两项性
能在多年来一直被网络开发者所忽略,直到最近Gmail, Google suggest和google Maps的横空出世才使人
们开始意识到其重要性.
这两项被忽视的性能是:
* 无需重新装载整个页面便能向服务器发送请求.
* 对XML文档的解析和处理.
......
function total(){
var i=0;
for(j=1;j<=20;j++)
{
var step="step"+j;
if(document.getElementById(step)){
if(document.getElementById(step).checked==true)
{
i=i+parseInt(document.getElementById(step).value);
}
}
}
document.getElementById("total").innerHTML = i;
}
function Resetvalue(){
......
Regular Expression Optimization 正则表达式优化
Incautiously crafted regexes can be a major performance bottleneck (the upcoming section, "Runaway Backtracking" on page 91, contains several examples showing how severe this can be), but there is a lot you can do to improve re ......
Data Formats 数据格式
When considering data transmission techniques, you must take into account several factors: feature set, compatibility, performance, and direction (to or from the server). When considering data formats, the only scale you need for comparison is speed.
......
第九章
Building and Deploying High-Performance JavaScript Applications
创建并部署高性能JavaScript应用程序
According to a 2007 study by Yahoo!'s Exceptional Performance team, 40%–60% of Yahoo!'s users have an empty cache experience, and about 20% of all page views are done ......