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

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

µÚÁùÕ  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" message that accompanies most form submissions. A user's natural inclination is to repeat any action that doesn't result in an obvious change, and so ensuring responsiveness in web applications is an important performance concern.
    ûÓÐʲô±Èµã»÷Ò³ÃæÉϵĶ«Î÷ȴʲôҲû·¢Éú¸üÁîÈ˸е½´ìÕÛÁË¡£Õâ¸öÎÊÌâÓֻص½ÁËԭʼÍøÒ³½»»¥³ÌÐòºÍÏÖÔÚÒÑÎÞ´¦²»ÔÚµÄÌá½»±íµ¥Ê±µ¯³öµÄ“ÇëÎðÖظ´Ìá½»”ÏûÏ¢ÉÏÃæ¡£Óû§×ÔÈ»ÇãÏòÓÚÖظ´³¢ÊÔÕâЩ²»·¢ÉúÃ÷ÏԱ仯µÄ¶¯×÷£¬ËùÒÔÈ·±£ÍøÒ³Ó¦ÓóÌÐòµÄÏìÓ¦ËÙ¶ÈÒ²ÊÇÒ»¸öÖØÒªµÄÐÔÄܹØ×¢µã¡£
    Chapter 1 introduced the browser UI thread concept. As a recap, most browsers have a single process that is shared between JavaScript execution and user interface updates. Only one of these operations can be performed at a time, meaning that the user interface cannot respond to input while JavaScript code is executed and vice versa. The user interface effectively becomes "locked" when JavaScript is executing; managing how long your JavaScript takes to execute is important to the perceived performance of a web application.
    µÚÒ»½Ú½éÉÜÁËä¯ÀÀÆ÷UIÏ̸߳ÅÄî¡£×ܵÄÀ´Ëµ£¬´ó¶àÊýä¯ÀÀÆ÷ÓÐÒ»¸öµ¥¶ÀµÄ´¦Àí½ø³Ì£¬ËüÓÉÁ½¸öÈÎÎñËù¹²Ïí£ºJavaScriptÈÎÎñºÍÓû§½çÃæ¸üÐÂÈÎÎñ¡£Ã¿¸öʱ¿ÌÖ»ÓÐÆäÖеÄÒ»¸ö²Ù×÷µÃÒÔÖ´ÐУ¬Ò²¾ÍÊÇ˵µ±JavaScript´úÂëÔËÐÐʱÓû§½çÃæ²»ÄܶÔÊäÈë²úÉú·´Ó¦£¬·´Ö®ÒàÈ»¡£»òÕß˵£¬µ±JavaScriptÔËÐÐʱ£¬Óû§½çÃæ¾Í±»“Ëø¶¨”ÁË¡£¹ÜÀíºÃJavaScriptÔËÐÐʱ¼ä¶ÔÍøÒ³Ó¦ÓõÄÐÔÄܺÜÖØÒª¡£
The Browser UI Thread  ä¯ÀÀÆ÷UIÏß³Ì
    The process shared by JavaScript and user interface updates is frequently referred to as the browser UI thread (though the term "thread" is not necessarily accurate for all browsers). The UI thread works on a sim


Ïà¹ØÎĵµ£º

[ת]¾«Í¨JSON (JavaScript Object Notation)


[ת×Ô]http://article.yeeyan.org/view/mouse4x/16540
JSON±»¹«ÈÏΪä¯ÀÀÆ÷ÖÐXMLµÄºó¼ÌÕߣ¬ËüµÄÄ¿±ê½ö½öÊdzÉΪһÖÖ¼òµ¥¡¢ÓÅÑŵÄÊý¾Ý¸ñʽ£¬ÒÔ·½±ãä¯ÀÀÆ÷ºÍ·þÎñÆ÷Ö®¼äµÄÊý¾Ý½»»»¡£ÔÚÍê³ÉÕâÒ»¼òµ¥ÈÎÎñµÄ¹ý³ÌÖУ¬Ëü½«ÒýÁìÏÂÒ»´úÍòάÍø¡£
¶ÔÏó¼ò½é
¿´,Õâ¾ÍÊÇÒ»¸ö¶ÔÏó:
var myFirstObject ={};
¾¡¹Ü¿´ÆðÀ´Í¦¼òµ¥£¬È»¶øÄÇЩ» ......

javascript typeofÓ¦ÓÃ

typeof ÊÇJavaScriptµÄÔËËã·û
    ——·µ»ØÒ»¸öÓÃÀ´±íʾ±í´ïʽµÄÊý¾ÝÀàÐ͵Ä×Ö·û´®
   typeof[(] expression [)]  //typeofÓï·¨ÖеÄÔ²À¨ºÅÊÇ¿ÉÑ¡Ïî
  typeof ÔËËã·û@import url(../html-vss/msdnie4a.css);
typeof
ÔËËã·û°ÑÀàÐÍÐÅÏ¢µ±×÷×Ö·û´®·µ»Ø¡£typeof
·µ»ØÖµÓÐÁ ......

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

Conditionals  Ìõ¼þ±í´ïʽ
    Similar in nature to loops, conditionals determine how execution flows through JavaScript. The traditional argument of whether to use if-else statements or a switch statement applies to JavaScript just as it does to other languages. Since different b ......

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

Recursion Patterns  µÝ¹éģʽ
    When you run into a call stack size limit, your first step should be to identify any instances of recursion in the code. To that end, there are two recursive patterns to be aware of. The first is the straightforward recursive pattern represented ......

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