Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö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»ù´¡ÖªÊ¶2

ÍæPHP¡¢Delphi¡¢Java»ù±¾É϶¼ÓжÔÏó£¬Ï°¹ßÕâÖÖ˼·ºóÉÏÊÖÈκÎÓïÑÔ¶¼Ïë¿¿OO˼·£¬Õâ¾ø²»ÊÇÔÚ¸Ïʱ÷Ö£¬¶øÊÇ°ÑÏà¹Ø´úÂë½øÐÐÄÚ¾ÛµÄÈ·¿ÉÒÔÌå»áµ½Î¬»¤µÄ·½±ã£¡
ÔÚJavaScriptÖÐÈçºÎ´´½¨¶ÔÏó£¿
JavaScriptÊÇ»ùÓÚ¶ÔÏóµÄ£¡ËüÒ²ÊÇÒÔObjectΪ¸ùÀ࣬ÆäËüÀà¼Ì³ÐÖ®¡£ÔÚ¸ùÀàÌṩÁ˼¸¸ö·½·¨¡£¹©¼Ì³ÐÀàʹÓã¡
ÒÔÏÂÊÇ´´½¨¶ÔÏóµÄÀý×Ó£º
funct ......

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(011)

Repaints and Reflows  ÖØ»æºÍÖØÅÅ°æ
    Once the browser has downloaded all the components of a page—HTML markup, JavaScript, CSS, images—it parses through the files and creates two internal data structures:
    µ±ä¯ÀÀÆ÷ÏÂÔØÍêËùÓÐÒ³ÃæHTML±ê¼Ç£¬JavaScri ......

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

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

Data Formats  Êý¾Ý¸ñʽ
    When considering data transmission techniques, you must take into account several factors: feature set, compatibility, performance, and direction (to or from the server). When considering data formats, the only scale you need for comparison is speed.
......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ