Changeset 18318
- Timestamp:
- 08/27/08 19:56:31 (4 months ago)
- Location:
- docs/tokuhirom/20080827-microblogcon-jobqueue
- Files:
-
- 1 modified
- 1 copied
-
. (copied) (copied from docs/tokuhirom/20080625-xsnite-vmgolf)
-
main.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
docs/tokuhirom/20080827-microblogcon-jobqueue/main.txt
r14649 r18318 1 Perl5VM Golf 1 Queueueueueue 2 2 <div style="text-align: right"> 3 2008-06-25(Wed) XS Nite 4 Mobile Factory Inc. 5 Tokuhiro Matsuno 3 2008-08-27(Wed) MicroBlogCon#1 4 tokuhirom 6 5 </div> 7 6 ---- 8 *VM Golf? 7 焦点。 8 Gearman/TheSchwartz と Q4M 9 9 ---- 10 perl5 has 11 Virtual Machine 10 随時ツッコミ歓迎 11 (主に id:kazuhooku の) 12 12 ---- 13 Virtual Machine 14 has 15 OP Code 13 Gearman 16 14 ---- 17 OP Code 18 の 19 総和 20 (Sum of opcode) 15 client, gearmand, worker 16 ---- 17 gearmand 18 - Gearman::Server 19 - pure perl 20 - binary protocol 21 - store jobs on memory 22 ---- 23 Gearman::Worker 24 - select(2) でまってるからリアルタイムだョ 25 ---- 26 Gearman::Client 27 - perl, ruby, python 28 ---- 29 Gearman::Client::Async 30 - Danga::Socket 31 - epoll(2)/kqueue(2)/select(2) 32 - 非同期に結果をうけとれる 33 - DJabberd 34 -- based on Danga::Socket 35 -- XMPP Server 36 ---- 37 用途 38 - Danga::Socket な鯖でブロッキング(DJabberd) 39 - ヒトコトを投稿したときのフック 40 ---- 41 フックでやること多すぎにつき 42 - IM に通知 43 - fav otsune 44 - リアルタイムで処理したいけど、Apache ではやるほどのこともない 45 ---- 46 TheSchwartz 47 ---- 48 - reliable job queue 49 - MySQL にがんばるの術 50 - インストール楽すぎる 51 ---- 52 reliable? 53 ---- 54 Yes! Gearman is not a reliable! 55 - 落ちちゃうときもある 56 - お茶目な存在 57 ---- 58 実装 59 - 1秒に一回ぐらい SQL うってジョブないかみてる 60 ---- 61 用途 62 - Feed の生成 63 - 画像ブログパーツのさくせい 64 - cron のスクリプト 65 - gearman → TheSchwartz 66 - etc. 67 ---- 68 Perl モジュールの読み込みおそいよー >< 69 そこで TheSchwartz 70 ---- 71 ポイント 72 - リアルタイム性がない 73 - 信頼できる男。MySQL 74 ---- 75 Q4M 76 ---- 77 持続的な非同期コミュニケーションのための 78 ミドルウェア 79 ---- 80 MySQL5.1 storage engine 21 81 ---- 22 82 >|| 23 0 null OP_NULL null operation 24 1 stub OP_STUB stub 25 2 scalar OP_SCALAR scalar 26 3 pushmark OP_PUSHMARK pushmark 27 4 wantarray OP_WANTARRAY wantarray 28 5 const OP_CONST constant item 29 6 gvsv OP_GVSV scalar variable 30 7 gv OP_GV glob value 31 8 gelem OP_GELEM glob elem 32 9 padsv OP_PADSV private variable 33 10 padav OP_PADAV private array 34 11 padhv OP_PADHV private hash 35 12 padany OP_PADANY private value 36 13 pushre OP_PUSHRE push regexp 37 14 rv2gv OP_RV2GV ref-to-glob cast 38 ... 83 while (1) { 84 SELECT queue_wait('queue'); # XXX block! 85 my @row = SELECT ROW * FROM queue or next; 86 # snip 87 } 39 88 ||< 40 89 ---- 41 めざすスコアぴったりをねらう 42 バイト数をへらす 43 (short code is good) 90 Q4Mでしかできないこと 91 - キューの (reliable) forward 92 - 特定のフィールドの条件を指定した conditional subscription 93 ってあたりになるのかなぁ 94 (id:kazuhooku 談) 44 95 ---- 45 *1000op 96 みんな Q4M つかえばいいよ! 46 97 ---- 47 "n"+"i"+"p"+"o"+"t"-"a"<<$$$n 48 >|| 49 hit: 5op(const, constant item) 50 hit: 5op(const, constant item) 51 hit: 62op(add, addition (+)) 52 hit: 5op(const, constant item) 53 hit: 5op(const, constant item) 54 hit: 62op(add, addition (+)) 55 ... 56 ||< 98 Q4M の欠点。 57 99 ---- 58 snip snip snip 59 ---- 60 <span style="font-size: 10px;">つづき</span> 61 >|| 62 hit: 5op(const, constant item) 63 hit: 6op(gvsv, scalar variable) 64 hit: 15op(rv2sv, scalar dereference) 65 hit: 15op(rv2sv, scalar dereference) 66 hit: 68op(left_shift, left bitshift (<<)) 67 hit: 178op(leave, block exit) 68 Your perl is : 5.8.8 69 Your score is : 1000op 70 ||< 71 ---- 72 29B 73 ---- 74 *Other Asnwers 75 ---- 76 ``;``;1*1 77 17B 78 backtick++ 79 ---- 80 1>>-f1%1-f1.-f1 81 15B 82 83 253op(ftfile, -f) 84 ---- 85 do+1<<(1<<1) 86 12B 87 88 310op(dofile, do "file") 89 ---- 90 !!!!$a>=1 91 9B 92 93 96op(not, not) 94 ---- 95 1<<[]-[] 96 8B 97 98 143op(anonlist, anonymous list ([])) 99 21op(srefgen, single ref constructor) 100 ---- 101 1/!!!!1 102 7B 103 ---- 104 *2000op 105 ---- 106 {$a++}{[]} 107 10B 108 109 loop makes too much op code! 110 ---- 111 *3000op 112 ---- 113 {{{~!1};!!1};}!1 114 16B 115 ---- 116 *Let's try! 117 ---- 118 perl -MAcme::PerlVMGolf -e '0' 100 インスコまんどいお >< 119 101 ---- 120 102 That's all.
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)