Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

[·­Òë]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¶ÔÏó£¬ÒÔ¼°¸ü¶à¹¦ÄÜ¡£Ëü»¹°üÀ¨Ò»¸öÐÔÄܺÍÍøÂç·ÖÎöÆ÷£¬ÕâÊDZ¾½ÚµÄÖØµã¡£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


Ïà¹ØÎĵµ£º

javascriptЧÂʾ­Ñé̸(Ò»)

±¾ÎÄÖ÷ÒªÊdzöÓÚÓÐÅóÓÑʹÓÃÎÒÔ­À´Ð´µÄautocompleteµÄJS¿Ø¼þ¡£µ±Êý¾ÝÁ¿´óµÄʱºò£¬»á³öÏÖЧÂʼ«ÆäÂýµÄÇé¿ö£¬ÎÒÔÚÕâ¶Îʱ¼ä×ö³öµÄһЩ²âÊÔÒ²¼°Ò»Ð©¾­Ñ飬Óë´ó¼Ò·ÖÏí£¬Èç¹ûÓдíµÄµØ·½£¬»¹ÇëÖ¸³ö¡£
¾­¹ý²âÊÔ£¬ÎÒÃǻᷢÏÖÈçϵÄÇé¿ö»òÕß˵µÄ½áÂÛ£¬Èç¹ûÄúµÄ²âÊÔ½á¹ûÓëÎҵIJ»·û£¬Çë˵Ã÷Ô­Òò£¬ÒÔ±ãÏ໥ѧϰ¡£
1£©µ±Ò»¸ö½Ï´óµÄHTML×Ö· ......

[·­Òë]High Performance JavaScript(016)

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 ......

[·­Òë]High Performance JavaScript(017)

A Note on Benchmarking  ²âÊÔ»ù׼˵Ã÷
    Because a regex's performance can be wildly different depending on the text it's applied to, there's no straightforward way to benchmark regexes against each other. For the best result, you need to benchmark your regexes on test strings o ......

[·­Òë]High Performance JavaScript(022)

µÚÆßÕ  Ajax  Òì²½JavaScriptºÍXML
    Ajax is a cornerstone of high-performance JavaScript. It can be used to make a page load faster by delaying the download of large resources. It can prevent page loads altogether by allowing for data to be transferred between the client ......

[·­Òë]High Performance JavaScript(027)

µÚ¾ÅÕÂ
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 ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ