Created
November 15, 2012 10:09
-
-
Save tanakh/4077813 to your computer and use it in GitHub Desktop.
C vs Python vs Ruby vs Haskell(無意味な処理deベンチマーク) ref: http://qiita.com/items/c53751e780a89941243a
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| mylist :: Int -> [[Int]] | |
| mylist n = take n $ iterate (map (+n)) [1..n] | |
| main :: IO () | |
| main = print.last.last $ map reverse $ mylist 4000 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $ ghc -O2 muda.hs && time ./muda | |
| 15996001 | |
| real 0m2.164s | |
| user 0m1.912s | |
| sys 0m0.248s |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| mylist :: Int -> [[Int]] | |
| mylist n = take n $ map (take n) $ iterate (drop n) [1..n^2] | |
| main :: IO () | |
| main = print.last.last $ map reverse $ mylist 4000 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $ ghc -O2 muda.hs && time ./muda | |
| [1 of 1] Compiling Main ( muda.hs, muda.o ) | |
| Linking muda ... | |
| 15996001 | |
| real 0m0.565s | |
| user 0m0.556s | |
| sys 0m0.004s |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| mylist :: Int -> [[Int]] | |
| mylist n = | |
| [ take n [ i * n + 1 .. ] | |
| | i <- [0 .. n - 1] | |
| ] | |
| main :: IO () | |
| main = print.last.last $ map reverse $ mylist 4000 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $ ghc -O2 muda.hs && time ./muda | |
| [1 of 1] Compiling Main ( muda.hs, muda.o ) | |
| Linking muda ... | |
| 15996001 | |
| real 0m0.002s | |
| user 0m0.000s | |
| sys 0m0.000s |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment