[Cython] Speed of cython.compile

Robert Bradshaw robertwb at math.washington.edu
Wed Sep 21 07:06:17 CEST 2011


On Tue, Sep 20, 2011 at 9:44 PM, Robert Bradshaw
<robertwb at math.washington.edu> wrote:
> 2011/9/19 Stéfan van der Walt <stefan at sun.ac.za>:
>> Hi all,
>>
>> I only recently found out that the mailing list had shifted, so I hope
>> my message reaches you this time!
>>
>> On the current development version of Cython, the attached script
>> makes Cython go into an infinite loop, but let's hope that's just on
>> my machine.
>>
>> Regards
>> Stéfan
>>
>> ---------- Forwarded message ----------
>> Date: 2011/8/21
>> Subject: Speed of cython.compile
>> To: cython-dev at codespeak.net
>>
>> Hi all,
>>
>> I am trying to illustrate Cython's pure mode for a tutorial, and made
>> up a quick fibonacci example (attached).  But when I run the timings,
>> I get:
>>
>> Cython: 5.515417099
>> Python: 0.123511791229
>>
>> When I compile the module by hand (.pyx -> .c -> .so) the timings are perfect:
>>
>> Cython: 0.0394787788391
>> Python: 0.119538068771
>>
>> Any idea what's going on?  I cleared ~/.cython just to be sure, but
>> that didn't help.
>
> Up until https://github.com/cython/cython/commit/cc43e481654c802fb88620de45a3a14257911999
> , @cython.compile didn't correctly interpret pure directives.
> Statements like
>
> @cython.compile
> @cython.locals(n=int)
> def fib(n):
>   ...
>
> are still on the todo list. Looks like I'm seeing the infinite loop
> too; looking into it.

I think the "infinite loop" is re-parsing the code for each of your
n=1000 iterations.

- Robert


More information about the cython-devel mailing list