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

Alex Gaynor alex.gaynor at gmail.com
Fri Aug 30 19:04:55 CEST 2013


Fixing the code is fine with me, does someone want to help get that patch
upstream into CPython so we don't have to worry about losing our
modifications when we upgrade the stdlib?

Alex


On Fri, Aug 30, 2013 at 9:47 AM, Carl Friedrich Bolz <cfbolz at gmx.de> wrote:

> 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
>



-- 
"I disapprove of what you say, but I will defend to the death your right to
say it." -- Evelyn Beatrice Hall (summarizing Voltaire)
"The people's good is the highest law." -- Cicero
GPG Key fingerprint: 125F 5C67 DFE9 4084
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pypy-dev/attachments/20130830/0a791170/attachment-0001.html>


More information about the pypy-dev mailing list