MacBooKAir(2010) 竹内関数をLionとubuntuで動かしてみた2011/08/22 17:50

竹内関数(たらい回し関数)をsbcl,clispで動かしてみた
今回はOSで違いが出るか カーネルの出来の比較かな

SBCLはMACOSXの方が速いが SBCLのVersion差かな
CLISPは ubuntuの方が速い
どちらも Version差は MACOSX(Lion)の方が新しいversion使っている

---- MacBookAir ubuntu----
utcher@MacBookAir-13-2010:~$ sbcl
This is SBCL 1.0.45.0.debian, an implementation of ANSI Common Lisp.
More information about SBCL is available at <http://www.sbcl.org/>.

SBCL is free software, provided as is, with absolutely no warranty.
It is mostly in the public domain; some portions are provided under
BSD-style licenses. See the CREDITS and COPYING files in the
distribution for more information.
* (defun tarai (x y z)
(if (<= x y)
y
(tarai (tarai (1- x) y z) (tarai (1- y) z x) (tarai (1- z) x y))))

TARAI
* (time (tarai 12 6 0))

Evaluation took:
0.256 seconds of real time
0.260000 seconds of total run time (0.260000 user, 0.000000 system)
101.56% CPU
545,402,488 processor cycles
0 bytes consed

12
* (time (tarai 13 7 0))

Evaluation took:
1.774 seconds of real time
1.770000 seconds of total run time (1.740000 user, 0.030000 system)
99.77% CPU
3,768,360,616 processor cycles
0 bytes consed

13
* (time (tarai 14 8 0))

Evaluation took:
13.119 seconds of real time
13.120000 seconds of total run time (13.120000 user, 0.000000 system)
100.01% CPU
27,875,574,144 processor cycles
0 bytes consed

14
9
butcher@MacBookAir-13-2010:~$ clisp
i i i i i i i ooooo o ooooooo ooooo ooooo
I I I I I I I 8 8 8 8 8 o 8 8
I \ `+' / I 8 8 8 8 8 8
\ `-+-' / 8 8 8 ooooo 8oooo
`-__|__-' 8 8 8 8 8
| 8 o 8 8 o 8 8
------+------ ooooo 8oooooo ooo8ooo ooooo 8

Welcome to GNU CLISP 2.48 (2009-07-28) <http://clisp.cons.org/>

Copyright (c) Bruno Haible, Michael Stoll 1992, 1993
Copyright (c) Bruno Haible, Marcus Daniels 1994-1997
Copyright (c) Bruno Haible, Pierpaolo Bernardi, Sam Steingold 1998
Copyright (c) Bruno Haible, Sam Steingold 1999-2000
Copyright (c) Sam Steingold, Bruno Haible 2001-2009

Type :h and hit Enter for context help.

[1]> (defun tarai (x y z)
(if (<= x y)
y
(tarai (tarai (1- x) y z) (tarai (1- y) z x) (tarai (1- z) x y))))
TARAI
[2]> (time (tarai 12 6 0))
Real time: 10.343825 sec.
Run time: 10.33 sec.
Space: 0 Bytes
12
[3]> (time (tarai 13 7 0))
Real time: 75.92527 sec.
Run time: 75.81 sec.
Space: 0 Bytes


---- MAC OS X Lion ----
sbcl
This is SBCL 1.0.50, an implementation of ANSI Common Lisp.
More information about SBCL is available at <http://www.sbcl.org/>.

SBCL is free software, provided as is, with absolutely no warranty.
It is mostly in the public domain; some portions are provided under
BSD-style licenses. See the CREDITS and COPYING files in the
distribution for more information.
* (defun tarai (x y z)
(if (<= x y)
y
(tarai (tarai (1- x) y z) (tarai (1- y) z x) (tarai (1- z) x y))))

TARAI
* (time (tarai 12 6 0))

Evaluation took:
0.211 seconds of real time
0.210891 seconds of total run time (0.210676 user, 0.000215 system)
100.00% CPU
447,682,688 processor cycles
0 bytes consed

12
* (time (tarai 13 7 0))

Evaluation took:
1.569 seconds of real time
1.557294 seconds of total run time (1.555979 user, 0.001315 system)
99.24% CPU
3,332,954,232 processor cycles
0 bytes consed

13
* (time (tarai 14 8 0))

Evaluation took:
11.761 seconds of real time
11.698206 seconds of total run time (11.689279 user, 0.008927 system)
99.46% CPU
24,978,866,104 processor cycles
0 bytes consed

14
* (quit)
Suzuki-no-MacBook-Air-2:gcc butcher$ clisp
i i i i i i i ooooo o ooooooo ooooo ooooo
I I I I I I I 8 8 8 8 8 o 8 8
I \ `+' / I 8 8 8 8 8 8
\ `-+-' / 8 8 8 ooooo 8oooo
`-__|__-' 8 8 8 8 8
| 8 o 8 8 o 8 8
------+------ ooooo 8oooooo ooo8ooo ooooo 8

Welcome to GNU CLISP 2.49 (2010-07-07) <http://clisp.cons.org/>

Copyright (c) Bruno Haible, Michael Stoll 1992, 1993
Copyright (c) Bruno Haible, Marcus Daniels 1994-1997
Copyright (c) Bruno Haible, Pierpaolo Bernardi, Sam Steingold 1998
Copyright (c) Bruno Haible, Sam Steingold 1999-2000
Copyright (c) Sam Steingold, Bruno Haible 2001-2010

Type :h and hit Enter for context help.

[1]> (defun tarai (x y z)
(if (<= x y)
y
(tarai (tarai (1- x) y z) (tarai (1- y) z x) (tarai (1- z) x y))))
TARAI
[2]> (time (tarai 12 6 0))
Real time: 12.012141 sec.
Run time: 11.932853 sec.
Space: 0 Bytes
12
[3]> (time (tarai 13 7 0))
Real time: 87.78301 sec.
Run time: 87.133675 sec.
Space: 0 Bytes
13
[4]>

コメント

コメントをどうぞ

※メールアドレスとURLの入力は必須ではありません。 入力されたメールアドレスは記事に反映されず、ブログの管理者のみが参照できます。

※なお、送られたコメントはブログの管理者が確認するまで公開されません。

※投稿には管理者が設定した質問に答える必要があります。

名前:
メールアドレス:
URL:
次の質問に答えてください:
下記の文字を入力して下さい(半角スペースあります)
Hoge desu

コメント:

トラックバック