Skip to content

Instantly share code, notes, and snippets.

@nikuuchi
Created March 7, 2012 05:52
Show Gist options
  • Select an option

  • Save nikuuchi/1991328 to your computer and use it in GitHub Desktop.

Select an option

Save nikuuchi/1991328 to your computer and use it in GitHub Desktop.
ocamloptとocamlcの速度の違いを見たかったのでフィボナッチ書いてみた。
let rec fibo n = if n < 2
then 1
else fibo(n-1)+fibo(n-2);;
print_int(fibo(36));;
print_string("\n");;
実行環境
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
@nikuuchi
Copy link
Copy Markdown
Author

nikuuchi commented Mar 7, 2012

Ocamlのバージョンは 3.12.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment