On Tue, Apr 9, 2013 at 1:44 PM, Nils Bruin <nbr...@sfu.ca> wrote:
> On Apr 9, 1:18 pm, Tom Boothby <tomas.boot...@gmail.com> wrote:
>> This shouldn't really come as a surprise.  From the Cython documentation,
>>
>> "This is about 20 times slower, but still about 10 times faster than
>> the original Python-only integration code. This shows how large the
>> speed-ups can easily be when whole loops are moved from Python code
>> into a Cython module."
>
> Since it is entirely unclear from that tutorial what the factor 20 (or
> the factor 10) refers to, I would not have understood that code to
> mean "even the fastest path of a cpdef function is slower than a
> cdef". There is a lot of documentation around that states "a cpdef
> function is essentially a cdef function that is also available and
> override-able as a python function" without stating that the
> overriding can also take effect at cdef level and (naturally) causes
> overhead.

To let x.foo() call different functions depending on whether your in
Cython or Python, or even worse whether x is fully typed, would be
even more surprising. Eventually, it would be interesting to
explicitly disallow overrides for performance reasons, but that's hard
to enforce.

I bet we could leverage tp_version_tag though, I'm going to give that a try.

> I think this definitely deserves to be clarified in the
> cython documentation.

Yes, please, send us a pull request :).

- Robert

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to