1 Feb 2008 10:12
Re: [Cython] Some more optimisations
Hi Robert, Robert Bradshaw wrote: > On Jan 24, 2008, at 2:53 AM, Stefan Behnel wrote: >> What I could imagine, on the other hand, is exploiting the type hint >> given by >> *args and **kwargs and propagate that (at least up to the next >> assignment), so >> that access to the variables can use straight PyAPI calls. But as Kay >> noted, >> we don't currently have a framework for questions like: where is "the >> next assignment?". > > What we need is special list/dict/tuple types. I know Greg (eventually) > plans to do something like this too. They would be like extension types, > though should fail for subtypes (e.g. if one subclasses a list, then one > can't assign it to a cdef list variable, or it might invalidate using > the faster api's). If we require exact types (no subtypes), we would be inconsistent with how things currently work for extension types (and Python types). The only exception are plain C types. So here, list/dict/tuple would basically behave like a C type (but I guess it would be enough to document that...) > As for the type assignment propagation, I think we need to introduce a > two-pass analyses_types. There would be a special undeclared type, and > by tracking assignments one could create a dependancy tree of types. One > would then use this to resolve all variable types and run analyses_types > again. >(Continue reading)
RSS Feed