[pythran] pattern detection

  • From: pierrick Brunet <pierrick.brunet@xxxxxxxx>
  • To: pythran@xxxxxxxxxxxxx
  • Date: Thu, 21 Nov 2013 11:16:45 +0100

Hi everyone,

I know there is some more important thinks to do for now (like PyHPC :-) ) but we spoke about detecting some common python pattern to compute them more efficiently.

For example : len(set(...)) is a common pattern to compute number of unique elements in a list or iterator.

a way to do is to create our own python library and change len(set(...)) -> pythran_lib.unique_elts(...) and then we just have to implement efficient computation like with others library. The problem is that new code will not be python compliant code as this library doesn't exists so constantFolding will not work. Of course, we can implement a python library doing correct think but it is not really what pythran should do IMO. Another solution is to do it AFTER constantfolding but the real question is : why in this case constantfolding is not done before all others modifications?

Have a good week end everyone :-)

PS : serge I am on your PR :-)


Other related posts: