Created
March 7, 2012 05:52
-
-
Save nikuuchi/1991328 to your computer and use it in GitHub Desktop.
ocamloptとocamlcの速度の違いを見たかったのでフィボナッチ書いてみた。
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
| let rec fibo n = if n < 2 | |
| then 1 | |
| else fibo(n-1)+fibo(n-2);; | |
| print_int(fibo(36));; | |
| print_string("\n");; |
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
| 実行環境 | |
| Linux debian 3.0.0-1-amd64 | |
| Intel(R) Core(TM)2 Duo CPU U9400 @ 1.40GHz | |
| MemTotal: 3994456 kB | |
| [1]ocamlcの場合 | |
| ./a.out 2.62s user 0.00s system 99% cpu 2.639 total | |
| [2]ocamloptの場合 | |
| ./a.out 0.54s user 0.00s system 99% cpu 0.545 total |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Ocamlのバージョンは 3.12.1