13/05/04 09:13:59.47
>>530
PythonでCython使って書いたら相当速くなった(53.98 -> 2.63)
こんな感じに、Perlにも高速化の手段があるんだろう
ソースコードはこれ
cimport cython
cdef fib(int n):
if n < 2: return n
return fib(n - 2) + fib(n - 1)
print(fib(38))
実行結果はこれ(CPython版との比較)
$ time python fib.py
39088169
python fib.py 53.82s user 0.04s system 99% cpu 53.983 total
$ time python fibc.py
39088169
python fibc.py 2.61s user 0.02s system 99% cpu 2.635 total