Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö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×Ö· ......

javascriptʵÏÖ×Ô¶¯ÇóºÍ

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(){
......

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

µÚÎåÕ  Strings and Regular Expressions  ×Ö·û´®ºÍÕýÔò±í´ïʽ
    Practically all JavaScript programs are intimately tied to strings. For example, many applications use Ajax to fetch strings from a server, convert those strings into more easily usable JavaScript objects, and ......

[·­Òë]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 ......

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

JavaScript Minification  JavaScript½ô´Õ
    JavaScript minification is the process by which a JavaScript file is stripped of everything that does not contribute to its execution. This includes comments and unnecessary whitespace. The process typically reduces the file size by ha ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ