ToDo:
http://d.hatena.ne.jp/ytqwerty/20080525#p1
¹Ô¤¯¤ó¤Ê¤é¸Æ¤ó¤Ç¤¯¤À¤µ¤ì¤ÐÈô¤ó¤Ç¤¤¤¯¤Î¤Ë¤È¤¤¤¦¡£ ¤¢¤È²¼Ë̤Ï̤¦¤È»×¤¦¡£²¿Ç¯¤¿¤Ã¤Æ¤â̤¦¡£ ¤¢¤È¥Þ¥¸¥¹¥Ñ¤ÏÂΤˤ¤¤¤¤É¤³¤í¤«´ðËÜŪ¤ËÆÇʪ¤À¤È»×¤¦¤¢¤ì¤Ï¡£ µõ¶õ100¤é¤Ø¤ó¤¢¤¿¤ê¶ô¤¦¤È³Î¼Â¤ËÊ¢²¼¤¹¤·¡¢ ¥¢¥¯¥¨¥ê¥¢¥¹¶ô¤Ã¤Æ¤ëºÇÃæ¤ËÊ¢²õ¤·¤Æ¤ë´¶¤¸¤¬¤·¤¿¡£ ¤¿¤Ö¤óÂΤ¬¤³¤ì¤ÏÆǤÀ¡¼½Ð¤»¡¼½Ð¤»¡¼¤È¶ÛµÞ»ØÎá¤ò½Ð¤·¤Æ¤ë¤ó¤À¤È»×¤¤¹þ¤ó¤Ç¤¤¤ë
(00:54)
¤º¤Ã¤È°¤¤¤¬¹Ô¤±¤Ê¤¤¤Û¤É¤Ç¤â¤Ê¤¤¤Î¤¬¤Ë¤ó¤È¤â¡£ ½Ð¼Ò¤·¤¿Êý¤¬¥é¥¯¤ËÊä¿©¤Ç¤¤ë¤È¤¤¤¦¤Î¤â¤Ë¤ó¤È¤â
(08:36)
¤Ê¤ó¤«¤è¤¯¹Í¤¨¤ë¤È¼¡¡¹¾É¾õ¤¬ÊѤï¤Ã¤Æ¤ëµ¤¤¬¤¹¤ë¡£
ºÇ½é¤ÏÇ®¤Ã¤Ý¤¤¡¢¤À¤ë¤¤¡¢Æ¬¤¬¤¤¤¿¤¤¡¢¤Ã¤Æ´¶¤¸¤Ç¡¢ ¤Þ¤¡ÉáÄ̤˻Żö¤È¤«¤¤¤¦´¶¤¸¤¸¤ã¤Ê¤«¤Ã¤¿¡£ ¤½¤Î¸å¤ËÇ®·Ï¤Ï¤ª¤µ¤Þ¤ê¤Ä¤Ä¤Î¤É¤¬Äˤ¯¤Ê¤Ã¤Æ¡¢ ¼¡¤Ë¥»¥¤È¥Ï¥Ê¤¬½Ð¤ë¤è¤¦¤Ë¤Ê¤Ã¤¿¡£ ¥»¥¤È¥Ï¥Ê¤ÈÊ¿¹Ô¤·¤ÆÊ¢²õ¤·¤Æ¡¢²¼Î¡¤Ã¤Ý¤¯¤Ê¤Ã¤¿¡£ ¤Çº£¤Ï¥»¥¥Ï¥Ê¤Ê¤¯¤Ê¤Ã¤¿¤±¤ÉÊ¢²õ¤·&&°ß¤¬¤à¤«¤Ä¤¤¤¿¤êÅǤµ¤¤È¤«¡£
(20:20)
¤Ïή¹Ô¤é¤Ê¤¤¤È¾¡¼ê¤ËÁǿ͹ͤ¨¤Ç¹Í¤¨¤Æ¤ë¤Î¤Çή¹Ô¤Ã¤ÆÍߤ·¤¯¤Ê¤¤¡£ ÌÌÇò¤¤¤«¤É¤¦¤«¤È¤«¤è¤¯ÃΤé¤Ê¤¤¤±¤É¡¢ ñ¤Ë¼ºÇÔ¤·¤Ê¤¯¤Ê¤ë¤À¤±¤Îµ»½Ñ¤Ã¤Æ¤â¤¨¤Ê¤¤¤È¤«¤¤¤¦¸Ä¿ÍŪ¤Ê¥¢¥ì¤È¡¢ ¥¹¥ì¥Ã¥É¤È¤«¤É¤¦¤Ç¤â¤¤¤¤¤è¤È¤¤¤¦¸Ä¿ÍŪ¤Ê¥¢¥ì¤«¤é ´ðËÜŪ¤ËÍè¤Æ¤ë¤ï¤±¤À¤±¤É¡£
°ì±þËͤιͤ¨¤Ë¤è¤ë¤È¡¢ ¤ß¤ó¤Ê¥¹¥ì¥Ã¥É¥×¥í¥°¥é¥ß¥ó¥°Æñ¤·¤¤¤È¤«¸À¤Ã¤Æ¤ë¤±¤É¡¢ ¤¢¤ë¥ë¡¼¥ë¤ò¼é¤ì¤ÐÁ´Á³Æñ¤·¤¯¤Ê¤¤¡£ ¤½¤Î¥ë¡¼¥ë¤Ã¤Æ¤¤¤¦¤Î¤Ï¡Ö¥¹¥ì¥Ã¥É¤ò»È¤ï¤Ê¤¤¡× ¤Ã¤Æ¤¤¤¦´Êñ¤Ê¤â¤Î¤Ê¤ó¤À¤±¤É¡¢ ¤Ê¤«¤Ê¤«¤³¤ó¤Ê´Êñ¤Ê¥ë¡¼¥ë¤ò¼é¤ì¤Ê¤¤»Ò¤â¤¤¤ë¤é¤·¤¤¤Î¤Ç¡¢ Îã³°¤¬2¤Ä¤¯¤é¤¤¤¿¤Ö¤ó¤¢¤ë¡£
outputs = Array.new(N) threads = [] N.times do |i| threads << Thread.start(i) do |t| # ¤Ê¤ó¤«¤·¤Æ output[t] ¤ËÆþ¤ì¤ë end end threads.each{|th|th.join}
¤ß¤¿¤¤¤ËÌÀ¤é¤«¤Ë¤½¤ì¤¾¤ì¤¬ÆÈΩ¤ÇÆ°¤¯¥Ñ¥¿¡¼¥ó¤«¡¢ ¥¿¥¹¥¯¥¥å¡¼Åª¤Ê¤Î¤ò¶´¤ó¤ÇÀ¸»º¼Ô¾ÃÈñ¼Ô¤Î·Á¤Ë¤Ê¤ë¥Ñ¥¿¡¼¥ó¡£ http://shinh.skr.jp/m/?date=20080424#p01
Á°¼Ô¤Ï¤Þ¤¡¥í¥Ã¥¯¤È¤«¤¤¤é¤ó¤·¡¢ ¸å¼Ô¤â¥¿¥¹¥¯¥¥å¡¼¤À¤±¥í¥Ã¥¯¤¹¤ê¤ã´ðËÜŪ¤ËÂç¾æÉפʤϤº¤Ê¤Î¤Ç Á´Á³Æñ¤·¤¯¤Ê¤¤¡£ ¤Þ¤¡¥í¥°ÅǤ¯¤È¤«¡¢¶¦ÄÌÉôʬ¤â¤Á¤ç¤Ã¤È¤Ï¤¢¤ë¤À¤í¤¦¤±¤É¡¢ ¤Þ¤¡¤½¤³¤À¤±µ¤¤ò¤Ä¤±¤ì¤ÐOK¤Ê¤ï¤±¤Ç¡¢ ¤Þ¤¡¤½¤ó¤Ê¤Ë¤à¤º¤«¤·¤¯¤Ï¤Ê¤é¤ó¤È»×¤¦¡£
¤½¤ÎÆó¤Ä¤Î¥Ñ¥¿¡¼¥ó¤Î»þ¤â¡¢ ¥Ñ¥Õ¥©¡¼¥Þ¥ó¥¹Åª¤ò¤¹¤´¤¯¹Í¤¨¤Ê¤¤ã¤¤¤±¤Ê¤¤»ö¾ð¤È¤«¤¬¤Ê¤¤¤Ê¤é¡¢ ¥×¥í¥»¥¹¤ï¤±¤Á¤ã¤Ã¤Æ¤â¤¤¤¤¡£ Á°¼Ô¤Î¥Ñ¥¿¡¼¥ó¤ÏÊ̤Υޥ·¥ó¤ÇÆ°¤«¤·¤¿¤ê¤È¤«¤·¤ä¤¹¤¤¥Ñ¥¿¡¼¥ó¤À¤·¡¢ ¸å¼Ô¤Ï Unix pipe ¤È¤¤¤¦¶¯ÎϤǴÊñ¤ÊʪÂΤ¬½õ¤±¤Æ¤¯¤ì¤ë¤Ï¤º¡£
¤Ç¤Þ¤¡ËͤΥ롼¥ë¤ò¼é¤é¤º¤Ë ÊÂÎóÀ¤¬¤½¤ó¤Ê¤Ë¹â¤¯¤Ê¤¤¥·¡¼¥ó¤Ç¥¹¥ì¥Ã¥É¤ò»È¤¦¤È¡¢ ¤Þ¤¡ÂçÊѤʤ³¤È¤Ë¤Ê¤ë¤ó¤À¤±¤É¡¢ ¤½¤¦¤¤¤¦¥·¡¼¥ó¤Ã¤Æ¤Î¤Ï¡¢ ¥¹¥ì¥Ã¥É¤ò̵Íý¤Ë»È¤Ã¤Æ¤ë¤Ã¤Æ¤ï¤±¤Ç¡¢ ®ÅÙ¤¬Íߤ·¤¤¥·¡¼¥ó¤À¤È»×¤¦¤ó¤À¤±¤É¡¢ ¤½¤ó¤Ê¥·¡¼¥ó¤À¤È STM ¤ÏÃÙ¤¯¤Ê¤ë¤ó¤¸¤ã¤Ê¤¤¤Î¤«¤Ê¡£
¤¢¤È´Ø·¸¤½¤ó¤Ê¤Ê¤¤¤±¤É¡¢¥Ç¥Ã¥É¥í¥Ã¥¯¤¬µ¯¤¤ë¤«¤é ¥¹¥ì¥Ã¥É¤à¤º¤«¤·¤¤¤È¤«Ê¹¤¯¤³¤È¤¬¤¢¤ë¤±¤É¡¢ ¤¢¤ì¤â¤ª¤«¤·¤¤¤È»×¤¦¡£ ¥Ç¥Ã¥É¥í¥Ã¥¯µ¯¤¤¿¤é gdb ¤Ç¥¢¥¿¥Ã¥Á¤·¤Æ ¥Ð¥Ã¥¯¥È¥ì¡¼¥¹¸«¤¿¤é½ª¤ï¤ë¤ä¤í¤È¤¤¤¦¡£ ¥ì¡¼¥¹¥³¥ó¥Ç¥£¥·¥ç¥ó¤¬º¤¤ë¤È¤¤¤¦¤Î¤Ï¤½¤ÎÄ̤ê¤À¤È»×¤¦¡£ º£ÅÙ¤³¤ìÆɤ⤦: http://valgrind.org/docs/manual/hg-manual.html#hg-manual.data-races.summary
¤Ç¤Þ¤¡ÏÃÌᤷ¤Æ·ë¶É¥¹¥ì¥Ã¥É¥×¥í¥°¥é¥à¤¬ËÜÅö¤ËɬÍפǡ¢ ¤«¤Ä¥¹¥ì¥Ã¥É¥×¥í¥°¥é¥à¤¬Æñ¤·¤¤¥×¥í¥°¥é¥à¤Î¥É¥á¥¤¥ó¤Ã¤Æ ¤¢¤ó¤Þ¤êÃΤé¤Ê¤¤¤ó¤À¤è¤Ê¡¼¤È¤¤¤¦¤³¤È¤¬¤¢¤Ã¤Æ¡¢ ¤¿¤Ö¤óÊÂÎó GC ¤À¤È¤«¡¢¥×¥í¥°¥é¥à¸À¸ìºî¤ë¤È¤«¡¢ ¤¹¤´¤¤´ðËÜŪ¤Ê¥é¥¤¥Ö¥é¥êºî¤ë¤È¤«¡¢ ÍפϸÀ¸ì½èÍý·Ï¤Þ¤ï¤ê°Ê³°¤Ë¤½¤¦¤¤¤¦¥É¥á¥¤¥ó»×¤¤¤Ä¤«¤ó¤È¤¤¤¦¡£ ¤Ç¤â¤½¤¤¤¦¤Îºî¤ë¤Î¤Ã¤Æ°ì°®¤ê¤Î¿Í¤¿¤Á¤Ê¤Î¤Ç¡¢ ¤½¤ó¤Ê¤³¤ó¤Ê¤Ç¥¹¥ì¥Ã¥É¤Ã¤Æ¤½¤ó¤Ê¤ËÆñ¤·¤¤¤Î¤«¤Ê¡¼¤È»×¤Ã¤Æ¤¤¤ë¡£
¤¿¤Ö¤ó¥Ý¥¤¥ó¥¿¤¯¤é¤¤¤ÎÆñ°×Å٤ʤ󤸤ã¤Ê¤¤¤«¤Ê¡£ °ÕÌ£ÉÔÌÀ¤ÊÈæ³Ó¤À¤¬¡£
¤¢¡¼¤Ç¤â HPC ¤ÎÀ¤³¦¤È¤«Á´¤¯ÃΤé¤ó¤Î¤ÇÃΤé¤ó¡£
(22:44)
ñ¤ËÊ£»¨¤Ê¥×¥í¥°¥é¥à¤ò³Ú¤·¤ß¤¿¤¤¤È¤¤¤¦¤Ê¤éƱ°Õ¤¹¤ë¤Î¤Ç ¸ʬ¤Ë¥¹¥ì¥Ã¥ÉÃϹö¤òÌ£¤ï¤Ã¤¿¤é¤¤¤¤¤È»×¤¦¡£ ¤·¤«¤·¤½¤ó¤Ê¿Í¤Ï STM ¤È¤«¤¤¤é¤Ê¤¤¤è¤Í?
(22:46)
¤ä¤á¤¿¤é¤À¤¤¤Ö®¤¯¤Ê¤Ã¤¿¡£
Ruby 1.9
> ruby1.9 bench_loop.rb user system total real for: 3.400000 0.010000 3.410000 ( 3.431349) times: 0.980000 0.000000 0.980000 ( 0.976049) upto: 0.920000 0.000000 0.920000 ( 0.913937) while: 0.480000 0.000000 0.480000 ( 0.488412)
yajit
for: SEGV times: ./rubyjit.rb hoge.rb 0.52s user 0.01s system 98% cpu 0.532 total upto: ./rubyjit.rb hoge.rb 0.52s user 0.00s system 97% cpu 0.531 total while: ./rubyjit.rb hoge.rb 0.19s user 0.00s system 96% cpu 0.199 total
¤³¤ì¤¬µ¡³£¸ì¤ÎÎϤÀ¡¼(SEGV´Þ¤à)
http://shinh.skr.jp/m/?date=20080525#p07
ŬÅö¤Ë¤Ò¤Ã¤³¤Ì¤¤¤Æ¤¤¿ Euler 55 ¤ò¤¤¤¸¤Ã¤¿¥³¡¼¥É
> time ruby1.9 euler55.rb 249 ruby1.9 euler55.rb 1.75s user 0.00s system 98% cpu 1.785 total > time ./rubyjit.rb euler55.rb 249 ./rubyjit.rb euler55.rb 1.66s user 0.01s system 99% cpu 1.677 total
¤³¤Ã¤Á¤â¾¡¤Ã¤¿¤«¡£
¤È¤ê¤¢¤¨¤ºÂ®¤¤¤È¤³ benchmark ¥â¥¸¥å¡¼¥ëÆ°¤¯¤è¤¦¤Ë¤·¤è¤¦¡£ ¤¢¤È¤Ê¤ó¤« OSX ¤È¤«¤Ç¤â»î¤½¤¦¤È»×¤Ã¤¿¤é OSX mremap ̵¤¤¤Î¤Í¡¼
(23:36)
Á° | 2008ǯ 5·î |
¼¡ | ||||
Æü | ·î | ²Ð | ¿å | ÌÚ | ¶â | ÅÚ |
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
Á´¤Æ¥ê¥ó¥¯¥Õ¥ê¡¼¤Ç¤¹¡£ ¥³¡¼¥ÉÊҤϼ«Í³¤Ë»ÈÍѤ·¤Æ¤¤¤¿¤À¤¤¤Æ¹½¤¤¤Þ¤»¤ó¡£ ¤½¤Î¾¤Î¤â¤Î¤ÏGPL°·¤¤¤Ç¤¢¤ì¤Ð¤¢¤é¤æ¤ë»ÈÍѤ˴ؤ·¤Æʸ¶ç¤Ï¸À¤¤¤Þ¤»¤ó¡£ ¤Ê¤Ë¤«¤¢¤ì¤Ð²¼µ¥á¡¼¥ë¥¢¥É¥ì¥¹¤Ø¡£
¤¤¤ä¤½¤ÎÃë¤Ë¹Ô¤³¤¦¤È·è¿´¤·¤ÆÈÕÈӤˤʤäƤ·¤Þ¤¦¤è¤¦¤ÊÂÎÄ´¤À¤Ã¤¿¤ï¤±¤Ç¤·¤Æ¤½¤Î¥´¥á¥ó¥Ê¥µ¥¤¡£