[翻译]High Performance JavaScript(031)
Firebug
Firefox is a popular browser with developers, partially due to the Firebug addon (available at http://www.getfirebug.com/), which was developed initially by Joe Hewitt and is now maintained by the Mozilla Foundation. This tool has increased the productivity of web developers worldwide by providing insights into code that were never before possible.
对开发人员来说,Firefox是一个时髦的浏览器,部分原因是Firebug插件(http://www.getfirebug.com/)由Joe Hewitt首创现在由Mozilla基金会维护。此工具具有前所未有的代码洞察力,提高了全世界网页开发者的生产力。
Firebug provides a console for logging output, a traversable DOM tree of the current page, style information, the ability to introspect DOM and JavaScript objects, and more. It also includes a profiler and network analyzer, which will be the focus of this section. Firebug is also highly extensible, enabling custom panels to be easily added.
Firebug提供了一个控制台日志输出,当前页面的DOM树显示,样式信息,能够反观DOM和JavaScript对象,以及更多功能。它还包括一个性能和网络分析器,这是本节的重点。Firebug易于扩展,可添加自定义面板。
Console Panel Profiler 控制台面板分析器
The Firebug Profiler is available as part of the Console panel (see Figure 10-1). It measures and reports on the execution of JavaScript on the page. The report details each function that is called while the profiler is running, providing highly accurate performance data and valuable insights into what may be causing scripts to run slowly.
Firebug分析器是控制台面板的一部分(如图10-1)。它测量并报告页面中运行的JavaScript。当分析器运行时,报告深入到每个被调用函数的细节,提供高精确的性能数据和变量察看功能,(有助于)找出可能导致脚本运行变慢的原因。
Figure 10-1. FireBug Console panel
图 10-1 FireBug控制台面板
One way to run a profile is by clicking the Profile button, triggering the script, and clicking the P
相关文档:
String Trimming 字符串修剪
Removing leading and trailing whitespace from a string is a simple but common task. Although ECMAScript 5 adds a native string trim method (and you should therefore start to see this method in upcoming browsers), JavaScript has not historically in ......
第六章 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 ......
Working Around Caching Issues 关于缓存问题
Adequate cache control can really enhance the user experience, but it has a downside: when revving up your application, you want to make sure your users get the latest version of the static content. This is accomplished by renaming ......