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

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

Use the Fast Parts  ʹÓÃËÙ¶È¿ìµÄ²¿·Ö
    Even though JavaScript is often blamed for being slow, there are parts of the language that are incredibly fast. This should come as no surprise, since JavaScript engines are built in lower-level languages and are therefore compiled. Though it's easy to blame the engine when JavaScript appears slow, the engine is typically the fastest part of the process; it's your code that is actually running slowly. There are parts of the engine that are much faster than others because they allow you to bypass the slow parts.
    ËäÈ»JavaScript¾­³£±»Ö¸Ôð»ºÂý£¬È»¶ø´ËÓïÑÔµÄijЩ²¿·Ö¾ßÓÐÄÑÒÔÖÃÐŵĿìËÙ¡£Õâ²»×ãÎªÆæÒòΪJavaScriptÒýÇæÓɵͼ¶ÓïÑÔ¹¹½¨¡£ËäÈ»JavaScriptËÙ¶ÈÂýºÜÈÝÒ×±»¹é¾ÌÓÚÒýÇæ£¬È»¶øÒýÇæÍ¨³£ÊÇ´¦Àí¹ý³ÌÖÐ×î¿ìµÄ²¿·Ö£¬Êµ¼ÊÉÏËÙ¶ÈÂýµÄÊÇÄãµÄ´úÂë¡£ÒýÇæµÄijЩ²¿·Ö±ÈÆäËü²¿·Ö¿ìºÜ¶à£¬ÒòΪËüÃÇÔÊÐíÄãÈÆ¹ýËÙ¶ÈÂýµÄ²¿·Ö¡£
Bitwise Operators  λ²Ù×÷ÔËËã·û
    Bitwise operators are one of the most frequently misunderstood aspects of JavaScript. General opinion is that developers don't understand how to use these operators and frequently mistake them for their Boolean equivalents. As a result, bitwise operators are used infrequently in JavaScript development, despite their advantages.
    λ²Ù×÷ÔËËã·ûÊÇJavaScriptÖо­³£±»Îó½âµÄÄÚÈÝÖ®Ò»¡£Ò»°ãµÄ¿´·¨ÊÇ£¬¿ª·¢Õß²»ÖªµÀÈçºÎʹÓÃÕâЩ²Ù×÷·û£¬¾­³£ÔÚ²¼¶û±í´ïʽÖÐÎóÓ᣽á¹ûµ¼ÖÂJavaScript¿ª·¢Öв»³£ÓÃλ²Ù×÷ÔËËã·û£¬¾¡¹ÜËüÃǾßÓÐÓÅÊÆ¡£
    JavaScript numbers are all stored in IEEE-754 64-bit format. For bitwise operations, though, the number is converted into a signed 32-bit representation. Each operator then works directly on this 32-bit representation to achieve a result. Despite the conversion, this process is incredibly fast when compared to other mathematical and Boolean operations in JavaScript.
    JavaScriptÖеÄÊý×Ö°´ÕÕIEEE-754±ê×¼64λ¸ñʽ´æ´¢¡£ÔÚλÔËËãÖУ¬Êý×Ö±»×ª»»ÎªÓзûºÅ32λ¸ñʽ¡£Ã¿ÖÖ²Ù×÷¾ùÖ±½Ó²Ù×÷ÔÚÕâ¸ö32λÊýÉÏÊ


Ïà¹ØÎĵµ£º

javascript typeofÓ¦ÓÃ

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

AJAX (Òì²½ JavaScript ºÍ XML)

AJAX (Òì²½ JavaScript ºÍ XML) ÊǸöвúÉúµÄÊõÓï,רΪÃèÊöJavaScriptµÄÁ½ÏîÇ¿´óÐÔÄÜ.ÕâÁ½ÏîÐÔ
ÄÜÔÚ¶àÄêÀ´Ò»Ö±±»ÍøÂ翪·¢ÕßËùºöÂÔ,Ö±µ½×î½üGmail, Google suggestºÍgoogle MapsµÄºá¿Õ³öÊÀ²ÅʹÈË
ÃÇ¿ªÊ¼Òâʶµ½ÆäÖØÒªÐÔ.
ÕâÁ½Ïî±»ºöÊÓµÄÐÔÄÜÊÇ:
* ÎÞÐèÖØÐÂ×°ÔØÕû¸öÒ³Ãæ±ãÄÜÏò·þÎñÆ÷·¢ËÍÇëÇó.
* ¶ÔXMLÎĵµµÄ½âÎöºÍ´¦Àí£® ......

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