
June 17, 2021
7:59 a.m.
On Thu, Jun 17, 2021 at 10:50 AM Chris Angelico <rosuav@gmail.com> wrote: > On Fri, Jun 18, 2021 at 12:43 AM Wes Turner <wes.turner@gmail.com> wrote: > > > > > What would be the advantage of such a declaration? > > > > Constants don't need to be locked or unlocked; which is advantageous for > parallelism and reasoning about program correctness. > > True consts (wherein everything referred to in that object is 'frozen' > and immutable or at least only modifiable with e.g. copy-on-write) > > wouldn't require locks, > > which would be post-GIL advantageous. > > > > That only works if you have a garbage collector that doesn't depend on > reference counts (as CPython's does). Otherwise, you still need to > modify the object, in a trivial sense, every time a reference is added > or removed. > - https://pythoncapi.readthedocs.io/gilectomy.html > Gilectomy is Larry Hastings’s project to attempt to remove the GIL from CPython. It a fork on CPython which uses lock per object rather than using a Global Interpreter Lock (GIL). - https://lwn.net/Articles/754577/ Update re: Gilectomy - There's probably a doc somewhere listing all of the post-GIL works? (Consts could be a helpful performance optimization for like all of the approaches I've seen) - https://lwn.net/Articles/754162/ Subinterpreters PEP > The PEP provides for a shared-nothing concurrency model. It has a minimal Python API in an interpreters module. It also adds channels to pass immutable objects between interpreters. A subinterpreter will retain its state, so the interpreter can be "primed" with modules and other setup in advance of its use. https://www.python.org/dev/peps/pep-0554/#a-disclaimer-about-the-gil https://distributed.dask.org/en/latest/memory.html#clearing-data > > ChrisA > _______________________________________________ > Python-ideas mailing list -- python-ideas@python.org > To unsubscribe send an email to python-ideas-leave@python.org > https://mail.python.org/mailman3/lists/python-ideas.python.org/ > Message archived at > https://mail.python.org/archives/list/python-ideas@python.org/message/BZ5WQZP5BSJEO3FY2H4DK4RLDHZBOO3M/ > Code of Conduct: http://python.org/psf/codeofconduct/ >