[pypy-dev] [pypy-commit] pypy default: Unroll list.count() when the list is virtual or very small and constant lenght

Carl Friedrich Bolz cfbolz at gmx.de
Fri Aug 30 18:47:26 CEST 2013


On 30/08/13 15:09, Alex Gaynor wrote:
> Hi Carl,
> 
> I wonder if there's some sub-set of cases we can still unroll in. The
> particular code this was for is:
> https://bitbucket.org/pypy/pypy/src/default/lib-python/2.7/uuid.py#cl-130 .

This is a completely indirect and way too clever way to express what is
meant. I have absolutely no pity for this code being slow. Let's
rewrite it to simply be more explicit, even if it's a few lines longer.

> I wonder if there are cases where the list is both virtual *and* we
> aren't able to constant fold some of the space.eq_w()?

Yes, there can be, it's easy to write. Even the uuid case has the
combinatorial problem, it's just that we expect people to not pass in
random combinations of arguments.

Cheers,

Carl Friedrich


More information about the pypy-dev mailing list