[Cython] Some more optimisations
Stefan Behnel
stefan_ml at behnel.de
Fri Feb 1 22:13:48 CET 2008
Hi,
Robert Bradshaw wrote:
> On Feb 1, 2008, at 1:12 AM, Stefan Behnel wrote:
>> - assignments replace the list content by their result of the
>> analyse_types()
>> for the right-hand side. This possibly requires taking into account the
>> current list of types, and it might mean we just append an additional
>> type
>> possibility.
>
> analyse_types() won't be able to do much until we actually know what the
> types in the expression are. I think the best we can do is build up a
> table of "this type depends on these types in this way."
So we'd build such a table for each statement?
>> - branches (if/loops) collect the results of each branch and sort the
>> types in
>> the expected order of probability - which might be arbitrary, but
>> could be
>> based on the number of occurrences over the branches.
>
> I'm not quite following here--how are branches/loops different than two
> adjacent statements?
I meant /after/ finishing the loop/if, when coming back to the other block.
if cond:
l = []
else:
l = function()
return l[0]
What is l here? Depends, but it's likely a list.
> I think for the first step, we should just leave functions (and class
> members) as they are now--we can come back to them later but this will
> make things much messier and less local (not to mention the issues of
> cimporting functions and types from other modules).
I agree. Getting the infrastructure in place and handling the easy cases would
be enough work for starters.
Stefan
More information about the Cython-dev
mailing list