[Cython] [cython] Initial startswith / endswith optimization (#35)

Dag Sverre Seljebotn d.s.seljebotn at astro.uio.no
Thu May 26 10:55:44 CEST 2011


On 05/26/2011 10:43 AM, Stefan Behnel wrote:
> Dag Sverre Seljebotn, 26.05.2011 10:24:
>> On 05/26/2011 10:12 AM, Stefan Behnel wrote:
>>> Robert Bradshaw, 26.05.2011 09:40:
>>>> the pattern of swapping out builtin methods (and perhaps
>>>> functions) with more optimized C versions is something that perhaps it
>>>> would be good to be able to do more generally, rather than hard coding
>>>> the list into Optimize.py.
>>>
>>> Right. All that would really be needed is a way to define default values
>>> for arguments of builtin methods. Then most of the method optimisations
>>> could be moved into Builtin.py.
>>
>> BTW, the idea of the overlay stuff Robert referred to was that we
>> could add
>> syntax to pxd files so that the "unicode" type and its alternative method
>> implementations could be fleshed out in a pxd file (and the same with
>> other
>> standard library or third-party types that are not written with Cython
>> support in mind, but may have a C API that we want to dispatch to instead
>> of their Python API).
>
> Well, dispatching to existing C-API functions is easy and can be done in
> Builtin.py. Moving that to .pxd files or not is a minor detail. The
> problems, as in this case, are that we often need to implement our own
> C-API and that we need to match defaulted arguments to suitable default
> values. I guess this could be done with inline methods, once we have
> something like overlay types in .pxd files.
>
> What's the status of Cython implemented utility code, BTW?

It's still bit-rotting in Kurt's branch, but it is working there. The 
plans are that I set aside a couple of days in June for merging that 
branch. I need to do so before Mark resumes his GSoC in July, so there's 
some pressure on me to finally get it done.

Dag Sverre


More information about the cython-devel mailing list