From 65939ef993f9dc52151aa5349e3453dd8cceda6d Mon Sep 17 00:00:00 2001 From: akovardakov Date: Mon, 29 Apr 2019 18:21:09 +0500 Subject: [PATCH] type of cpdef typed cpdef has same speed as cdef function --- doc/source/fibo_speed.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/source/fibo_speed.rst b/doc/source/fibo_speed.rst index b16205b..a128c38 100644 --- a/doc/source/fibo_speed.rst +++ b/doc/source/fibo_speed.rst @@ -46,7 +46,7 @@ In Cython calling C generated code. Here we use a ``def`` to call a ``cdef`` tha Now a recursive ``cpdef``:: - cpdef fib_cpdef(int n): + cpdef int fib_cpdef(int n): if n < 2: return n return fib_cpdef(n-2) + fib_cpdef(n-1) @@ -160,7 +160,7 @@ Python ``Fibo.fib(30)`` 390 x 1 Cython ``cyFibo.fib(30)`` 215 x 1.8 Cython ``cyFibo.fib_int(30)`` 154 x 2.5 Cython ``cyFibo.fib_cdef(30)`` 5.38 x72 -Cython ``cyFibo.fib_cpdef(30)`` 32.5 x12 +Cython ``cyFibo.fib_cpdef(30)`` 5.45 x72 C ``cFibo.fib(30)`` 5.31 x73 ======== =========================== ============= =================