C++ºÍJavaÖÐÀàÒýÓõÄÇø±ð
¡¡ÔÚC++ºÍJavaÖж¼´æÔÚÀàÒýÓã¬C++ÖÐÊÇÒªÃ÷È·Ö¸³öµÄ£¬ÏÔÐÔµÄ;¶øJavaÖÐÊÇÒþÐεġ£
¡¡¡¡ÔÚC++ÖУ¬"T &b=a;" ˵Ã÷bÊÇaµÄÒýÓã¬Á½ÕßÊÇͬÃû£¬Ö¸µÄͬһ¸ö¶«Î÷¡£¶ø·ÇÖ¸ÕëµÄÀàÉùÃ÷£¬¾Íͬʱ´´½¨ÁËÒ»¸öÀ࣬Èç"T a;"ʵ¼ÊÉÏaÒѾʵÀý»¯ÁË¡£¶øÉùÃ÷ÀàÒýÓÃʱ²»ÐèÒª´´½¨Ð¶ÔÏ󣬶øÊÇÖ±½ÓÖ¸ÏòÔÀ´µÄ¶ÔÏó¡£
¡¡¡¡ÀàÒýÓÃÔÚº¯ÊýµÄÐβκͷµ»ØÖµÖÐÆ𵽺ܴóµÄ×÷Óá£Ä¬ÈϵÄÀà²ÎÊý£¬ÊÇͨ¹ý¸´Öƺ¯Êý(ÖØÔØ=ÔËËã·û)£¬¸´ÖÆÈë²ÎÒ»¸öжÔÏó¸øº¯ÊýÌå¡£º¯ÊýÖÐÈç¹ûÐÞ¸ÄÐβΣ¬²»»á¶ÔÈë²ÎÓÐÓ°Ïì¡£Èç¹û·µ»ØÖµÒ²ÊÇÀ࣬ÄÇôҲ»áͨ¹ý¸´Öƺ¯Êý£¬¹¹ÔìÒ»¸öжÔÏ󷵻ظøµ÷ÓÃÕß¡£
¡¡¡¡Èç¹ûÐββÉÓÃÀàÒýÓã¬ÄÇôº¯Êý½«Ö±½ÓÒýÓÃÔÓеÄÈë²Î£¬´ËʱÐÞ¸ÄÐβξͻáÐÞ¸ÄÕæʵµÄÈë²Î¡£·µ»ØÖµÊÇÀàÒýÓÃʱ£¬½«²»ÔÙʹÓø´Öƺ¯Êý£¬¶øÊÇÖ±½Ó½«¶ÔÏ󷵻ظøµ÷ÓÃÕß¡£Èç¹û·µ»ØµÄ¶ÔÏóÊǾֲ¿±äÁ¿£¬ÄÇô²ÉÓÃÒýÓ÷µ»Ø¾Í»á³ö´í¡£
¡¡¡¡ÔÚJavaÖУ¬ÀàʵÀýÉùÃ÷ºÍ¹¹ÔìÊÇ·Ö¿ª¡£"T a;"ÊÇÉùÃ÷£¬¶ø"a=new T();"²ÅÊǹ¹Ôì¡£ÒýÓÃÉùÃ÷ºÍC++Ïàͬ¡£µ«ÊÇJavaµÄ»úÖÆÓëC++²»Í¬£¬JavaÖеÄÒýÓÃÒ²½Ð¾ä±ú£¬»òÕß˵¾ä±ú²ÅÊÇÆäÕæʵÃû³Æ¡£ÀàÉùÃ÷µÄ¶¼ÊÇÒ»¸ö¾ä±ú£¬µ÷Óù¹Ô캯Êý²Å»áʹµÃ¾ä±úÖ¸ÏòÀàʵÀý¡£Òò´ËJavaÖÐûÓÐÀàËÆÓÚC++Öеĸ´Öƺ¯Êý£¬ÒòΪJavaµÄ¸´Öƶ¼ÊÇÖ±½Ó¸´Öƾä±úÄÚÈÝ¡£ÀýÈç"T b=a;"Ö»²»¹ýÊǽ«aµÄ¾ä±ú¸´ÖÆ(¸³Öµ)¸øÁËb£¬´Ó¶øbÒ²Ö¸ÏòaÖ¸ÏòµÄÀàʵÀý¡£¿ÉÒÔ¿´³öJavaÓëC++ÔÚ´Ë´¦µÄ²»Í¬£¬JavaÒÀȻֻÓÐÒ»¸öʵÀý£¬¶øC++Ôò´æÔÚÁËÁ½¸öʵÀý¡£
¡¡¡¡ËùÒÔÔÚº¯ÊýÖУ¬JavaµÄÐβζ¼ÊÇÈë²ÎµÄ¾ä±ú¸´ÖÆ£¬²¢ÇÒÊÇdz¸´ÖÆ(Ö»¸´ÖƸþä±ú£¬¶ø²»¸´Öƾä±úÖ¸ÏòµÄÏÂÒ»²ã¾ä±ú)¡£Òò´ËÔÚº¯ÊýÖУ¬Ö±½ÓÐÞ¸ÄÐβÎÊDz»ÄܸıäÈë²ÎµÄ¡£µ«ÊÇÈç¹ûÐÞ¸ÄÐβÎÖ¸ÏòµÄ¶ÔÏóµÄÏÂÒ»²ã¾ä±úÔò»áÐÞ¸ÄÈë²Î¡£Òò´ËÔÚJavaÖв»´æÔÚÏñC/C++ÖÐÒ»ÑùµÄSwapº¯Êý¡£º¯ÊýµÄ·µ»ØÖµ£¬Ò²ÊǾä±ú¸´ÖÆ¡£Èç¹ûÔÚº¯ÊýÖй¹ÔìÒ»¸ö¾Ö²¿±äÁ¿ÀàʵÀý£¬ÄÇôÊÇ¿ÉÒÔ·µ»Øµ½ÍⲿµÄ£¬µ±È»ÄǸö¾Ö²¿±äÁ¿µÄ¾ä±úÊDz»´æÔÚÁË¡£
¡¡¡¡JavaÖÐÒª¸´ÖƶÔÏó£¬ÐèÒªÖØÔØcloneº¯Êý£¬²¢ÇÒÒª·ÖÇåÊÇdz¸´ÖÆ»¹ÊÇÉÖÆ(ÍêÈ«¹¹ÔìÒ»¸öжÔÏó£¬Á½ÕßµÄÄÚ²¿Êý¾ÝºÍʵÀý²»´æÔÚÖصþ)¡£
Ïà¹ØÎĵµ£º
http://www.trendcaller.com/2009/05/hadoop-should-target-cllvm-not-java.html
Sunday, May 10, 2009
Hadoop should target C++/LLVM, not Java (because of watts)
< type="text/javascript">
digg_url="http://www.trendcaller.com/2009/05/hadoop-should-target-cllvm-not-java.html";
Over the years, ......
×î½üÓöµ½ÁËÒ»¸öÎÊÌ⣬¾ÍÊÇÔÚÓõ½List.toArray ·½·¨Ê±£¬·µ»ØObject[]Êý×飬ֱ½Ó°ÑËüǿת³ÉÆäËûÀàÐ͵Ļᱨ´í£º
code: ArrayList list=getList();
String[] s=(String[])list.toArray();
except ......
ѧjavaÒѾÓÐÒ»¶Îʱ¼äÁË¡£Ñ§µÄ¶«Î÷²»¶à£¬µ«ÎÒûÏëµ½½ö½öÃæÏò¹ý³ÌµÄһЩ֪ʶ£¨Loops£©¾Í¿ÉÒÔ×ö³öÏñÎå×ÓÆåÕâÑùµÄÓÎÏ·£¬ÎÒ²»µÃ²»¸Ð̾javaÓïÑÔµÄ÷ÈÁ¦¡£ÌرðÊÇÁ˽⵽javaµÄÓ¦ÓÃÖ®¹â·º£¬Éæ¼°ÊÖ»ú£¬Ç¶Èëʽ¿ª·¢£¬pc£¬ÆóÒµ¼°·þÎñÆ÷µÈÖ®ºó£¬ÎÒ¸ü¼á¶¨ÁËѧϰjavaµÄ¾öÐÄ¡£µ«ÊÇÎÒÒ²µ£ÐÄ×Ô¼ºÑ§²»°¡ºÃ¡£ºÜ¶à¶«Î÷¶¼ÊÇÔÚÀÏʦµÄÀÏÁìµ¼ÏÂÍê³ÉµÄ£ ......
JavaÌṩÁËÊýÖÖ³ÖÓжÔÏóµÄ·½Ê½£¬°üÀ¨ÓïÑÔÄÚÖõÄArray£¬»¹ÓоÍÊÇutilitiesÖÐÌṩµÄÈÝÆ÷Àà(container
classes)£¬ÓÖ³ÆȺ¼¯Àà(collection classes)¡£¼¯ºÏÔÚjavaÖзdz£ÖØÒª£¬ÔÚÌÖÂÛ֮ǰ£¬ÏÈÀ´¿´¼¸¸öÃæÊÔÖеľµäÎÊÌâ¡£
1 Collection ºÍ
CollectionsµÄÇø±ð¡£
2 List, Set, MapÊÇ·ñ¼Ì³Ð×ÔCollection½Ó¿Ú¡£ ......