[PATCH] nogc: do disable gc for CPython

Augie Fackler raf at durin42.com
Wed May 24 16:13:03 EDT 2017


On Tue, May 23, 2017 at 06:03:53PM -0700, Gregory Szorc wrote:
> On Tue, May 23, 2017 at 1:20 PM, Jun Wu <quark at fb.com> wrote:
>
> > # HG changeset patch
> > # User Jun Wu <quark at fb.com>
> > # Date 1495570793 25200
> > #      Tue May 23 13:19:53 2017 -0700
> > # Node ID 66dc3a3b4631507fed3ea7fd2fa3e3356ea820fe
> > # Parent  34e9b8b94f66db7ebe366f67cea7b64bd0ec6968
> > # Available At https://bitbucket.org/quark-zju/hg-draft
> > #              hg pull https://bitbucket.org/quark-zju/hg-draft -r
> > 66dc3a3b4631
> > nogc: do disable gc for CPython

[...]

> >
> > +if pyplatform.python_implementation() != 'CPython':
> > +    # PyPy becomes slower with gc disabled
> >
>
> Since this patch sounds like it has more to do with PyPy, then
> implementation should check for =pypy, not !=cpython. Other than that, I'm
> fine keeping the GC in place on PyPy, as its JIT should mitigate impact
> from garbage spewing code.

I agree - this should be cpython-only.

>
> Also, regarding this whole no gc concept, I'll argue that any operation
> needing to disable GC should be implemented in C in such a way that it
> isn't instantiating thousands of CPython objects. So many of our C routines
> are relatively slow (revlog index, obsmarkers, dag walking, etc) because
> they operate on PyObject instead of raw C data structures. If we remove
> PyObject from critical path code, we eliminate most GC concerns and likely
> make execution at *least* 5x faster.

I also concur here - any uses of nogc are things that are ripe for
reworking into C code or something lazy.


More information about the Mercurial-devel mailing list