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

[·­Òë]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.
    ÔÚ¿¼ÂÇÊý¾Ý´«Êä¼¼Êõʱ£¬Äã±ØÐ뿼ÂÇÕâЩÒòËØ£º¹¦Äܼ¯£¬¼æÈÝÐÔ£¬ÐÔÄÜ£¬ºÍ·½Ïò£¨·¢¸ø·þÎñÆ÷»òÕß´Ó·þÎñÆ÷½ÓÊÕ£©¡£ÔÚ¿¼ÂÇÊý¾Ý¸ñʽʱ£¬Î¨Ò»ÐèÒª±È½ÏµÄ³ß¶ÈµÄ¾ÍÊÇËٶȡ£
    There isn't one data format that will always be better than the others. Depending on what data is being transferred and its intended use on the page, one might be faster to download, while another might be faster to parse. In this section, we create a widget for searching among users and implement it using each of the four major categories of data formats. This will require us to format a list of users on the server, pass it back to the browser, parse that list into a native JavaScript data structure, and search it for a given string. Each of the data formats will be compared based on the file size of the list, the speed of parsing it, and the ease with which it's formed on the server.
    ûÓÐÄÄÖÖÊý¾Ý¸ñʽ»áʼÖÕ±ÈÆäËû¸ñʽ¸üºÃ¡£¸ù¾Ý´«ËÍʲôÊý¾Ý¡¢ÓÃÓÚÒ³ÃæÉÏʲôĿµÄ£¬Ä³ÖÖ¸ñʽ¿ÉÄÜÏÂÔظü¿ì£¬ÁíÒ»ÖÖ¸ñʽ¿ÉÄܽâÎö¸ü¿ì¡£ÔÚ±¾½ÚÖУ¬ÎÒÃÇ´´½¨ÁËÒ»¸ö´°¿ÚС²¿¼þÓÃÓÚËÑË÷Óû§ÐÅÏ¢²¢ÓÃËÄÖÖÖ÷Á÷µÄÊý¾Ý¸ñʽʵÏÖËü¡£ÕâÒªÇóÎÒÃÇÔÚ·þÎñÆ÷¶Ë¸ñʽ»¯Ò»¸öÓû§ÁÐ±í£¬½«Ëü·µ»Ø¸øä¯ÀÀÆ÷£¬½«Áбí½âÎö³ÉJavaScriptÊý¾Ý¸ñʽ£¬²¢ËÑË÷Ìض¨µÄ×Ö·û´®¡£Ã¿ÖÖÊý¾Ý¸ñʽ½«±È½ÏÁбíµÄÎļþ´óС£¬½âÎöËٶȣ¬ºÍ·þÎñÆ÷ÉϹ¹ÔìËüÃǵÄÄÑÒ׳̶ȡ£
XML
    When Ajax first became popular, XML was the data format of choice. It had many things going for it: extreme interoperability (with excellent support on both the server side and the client side), strict formatting, and easy validation. JSON hadn't been formalized yet as an interchange format, and almost every language used on servers had a library available for working with XML.
&


Ïà¹ØÎĵµ£º

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

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

javaScript¹Ø±Õä¯ÀÀÆ÷ (²»µ¯³öÌáʾ¿ò)

£¼script language="javaScript"£¾
function closeWindow()
{
¡¡window.opener = null;
¡¡window.open(' ', '_self', ' ');
¡¡window.close();
}
£¼/script£¾
£¼input type='button' value='¹Ø±Õ´°¿Ú' onClick="closeWindow()"£¾
»ò
£¼input type="button" value="¹ ......

JavaScript»ù´¡ÖªÊ¶2

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

JavaScript»ù´¡ÖªÊ¶3

Òþ²Ø³ÉÔ±±äÁ¿
ÔÚº¯ÊýÌåÄÚ¶¨ÒåµÄ±äÁ¿Îª¾Ö²¿±äÁ¿£¬À뿪º¯Êý¾Í¹ÒµôÁË
ÔÚº¯ÊýÌåÄÚʹÓÃthis.³ÉÔ±±äÁ¿Ãû£¬ÔòΪwindow¶ÔÏ󼶱äÁ¿£¬¼´È«¾Ö±äÁ¿
¹ÊÐèÒªÕâÑùÒþ²Ø³ÉÔ±±äÁ¿£¬ÏòÍâÖ»±©Â¶get¡¢setº¯Êý
function testClass(name){
var _firstname=name;
return {
getname : function() {
return _fir ......

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