Haskell

もうちょっとアセンブリを読んでサンクを知ろう。

hac::Int->Int hac a=a+1 とhac a=a+2 のアセンブリのdiffを確かめる。 ghc -S test.hs ghc -S test2.hsdiff test.s test2.hs29c29stg_INTLIKE_closure+137,0(%ebp) - > movl $stg_INTLIKE_closure+145,0(%ebp) ……137ってなに…? 145-137=8 2word分遠いポイ…

型シグニチャがあるなしで吐かれるアセンブリはどうかわるか?

hac a=a+1 と、 それに hac::Int->Int をつけたもので比べてみると、 rw-r--r-- 1 ioriveur ioriveur 2126 2011-09-22 19:02 test.s rw-r--r-- 1 ioriveur ioriveur 1176 2011-09-22 19:02 testint.s と、俄然短くなる。行数で比べると119と64の差である。 …