[翻译]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.
当一个特定的脚本或应用程序没有达到最优状态时,一个性能分析器有助于安排优化工作的先后次序。不过,因为浏览器支持的范围不同,这可能变得很麻烦,但许多厂商在他们的调试工具中提供了性能分析器。有些情况下,性能问题可能与特定浏览器
相关文档:
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(){
......
第六章 Responsive Interfaces 响应接口
There's nothing more frustrating than clicking something on a web page and having nothing happen. This problem goes back to the origin of transactional web applications and resulted in the now-ubiquitous "please click only once" m ......
Yielding with Timers 用定时器让出时间片
Despite your best efforts, there will be times when a JavaScript task cannot be completed in 100 milliseconds or less because of its complexity. In these cases, it's ideal to yield control of the UI thread so that UI updates may occur ......
Splitting Up Tasks 分解任务
What we typically think of as one task can often be broken down into a series of subtasks. If a single function is taking too long to execute, check to see whether it can be broken down into a series of smaller functions that complete in smaller ......
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.
......