[pypy-dev] Copy-on-write list slicing as GSoC project

Armin Rigo arigo at tunes.org
Wed Mar 23 17:39:06 EDT 2016


Hi Nikolay,

On 14 March 2016 at 19:15, Николай Зинов <nzinov at gmail.com> wrote:
> I found implementing copy-on-write list slicing particularly interesting for
> me. Below go my ideas. Note, that at some places I see different possible
> choices so I need feedback.

Thanks for the early proposal; you should submit it to google's system
very soon.  I'm sorry it didn't receive more active feedback from the
main mentors.  One of the reasons is that this is likely more involved
than you describe.

In order to efficiently implement copy-on-write list slicing, we would
need some special GC support.  Otherwise, as you describe, there is
the problem that as soon as there exist a slice anywhere, we cannot
any more modify a big list without making a copy of the whole list.
Moreover, there is also the issue that if 'mylist[1:5]' is kept alive,
then the whole 'mylist' is also kept alive, even if it would not be
necessary; this can consume some extra memory but more importantly it
can delay calling destructors for arbitrarily long periods of time.

So, serious work on this topic should start with designing a usable GC
interface which fixes these problems; a bit like weakrefs, which are a
general GC interface.  The problem is that we don't really know what
such an interface could look like.


A bientôt,

Armin.


More information about the pypy-dev mailing list