[翻译]High Performance JavaScript(033)
来源:互联网 发布:js location.assign 编辑:程序博客网 时间:2024/06/08 17:29
Summary 总结
When web pages or applications begin to feel slow, analyzing assets as they come over the wire and profiling scripts while they are running allows you to focus your optimization efforts where they are needed most.
当网页或应用程序变慢时,分析网上传来的资源,分析脚本的运行性能,使你能够集中精力在那些需要努力优化的地方。
• Use a network analyzer to identify bottlenecks in the loading of scripts and other page assets; this helps determine where script deferral or profiling may be needed.
使用网络分析器找出加载脚本和其它页面资源的瓶颈所在,这有助于决定哪些脚本需要延迟加载,或者进行进一步分析。
• Although conventional wisdom says to minimize the number of HTTP requests, deferring scripts whenever possible allows the page to render more quickly, providing users with a better overall experience.
传统的智慧告诉我们应尽量减少HTTP请求的数量,尽量延迟加载脚本以使页面渲染速度更快,向用户提供更好的整体体验。
• Use a profiler to identify slow areas in script execution, examining the time spent in each function, the number of times a function is called, and the callstack itself provides a number of clues as to where optimization efforts should be focused.
使用性能分析器找出脚本运行时速度慢的部分,检查每个函数所花费的时间,以及函数被调用的次数,通过调用栈自身提供的一些线索来找出哪些地方应当努力优化。
• Although time spent and number of calls are usually the most valuable bits of data, looking more closely at how functions are being called might yield other optimization candidates.
虽然花费时间和调用次数通常是数据中最有价值的点,还是应当仔细察看函数的调用过程,可能发现其它优化方法。
These tools help to demystify the generally hostile programming environments that modern code must run in. Using them prior to beginning optimization will ensure that development time is spent focusing on the right problems.
这些工具在那些现代代码所要运行的编程环境中不再神秘。在开始优化工作之前使用它们,确保开发时间用在解决问题的刀刃上。
(译者:翻译完了,放个LOGO纪念一下)
- [翻译]High Performance JavaScript(033)
- [翻译]High Performance JavaScript(001)
- [翻译]High Performance JavaScript(002)
- [翻译]High Performance JavaScript(003)
- [翻译]High Performance JavaScript(004)
- [翻译]High Performance JavaScript(005)
- [翻译]High Performance JavaScript(006)
- [翻译]High Performance JavaScript(007)
- [翻译]High Performance JavaScript(008)
- [翻译]High Performance JavaScript(009)
- [翻译]High Performance JavaScript(010)
- [翻译]High Performance JavaScript(011)
- [翻译]High Performance JavaScript(012)
- [翻译]High Performance JavaScript(013)
- [翻译]High Performance JavaScript(014)
- [翻译]High Performance JavaScript(015)
- [翻译]High Performance JavaScript(016)
- [翻译]High Performance JavaScript(017)
- 最新IT求职应聘必读手册
- Oracle9i分析函数参考手册
- [翻译]High Performance JavaScript(032)
- 【网易有道10年编程赛 网络热身赛】第二题
- C#中NULL,"",DBNULL,String.Empty,Convert.IsDBNull()
- [翻译]High Performance JavaScript(033)
- 分页测试
- 【网易有道10年编程赛 网络热身赛】第三题 Sibonacci
- C# split 使用方法
- c++ 运算符重载
- 迷茫中,不知道该定哪个位
- Just friends 仅仅是朋友
- Sql Server基本函数
- js小程序 数组元素的添加和删除