Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

"It might help if we ran the MBA's out of Washington." -- Admiral Grace Hopper


devel / comp.lang.python / Re: GIL-Removal Project Takes Another Step (Posting On Python-List Prohibited)

SubjectAuthor
* GIL-Removal Project Takes Another Step (Posting On Python-List Prohibited)Lawrence D'Oliveiro
`* Re: GIL-Removal Project Takes Another Step (Posting On Python-List Prohibited)Paul Rubin
 `* Re: GIL-Removal Project Takes Another Step (Posting On Python-List Prohibited)Lawrence D'Oliveiro
  `* Re: GIL-Removal Project Takes Another Step (Posting On Python-List Prohibited)Paul Rubin
   `* Re: GIL-Removal Project Takes Another Step (Posting On Python-List Prohibited)Lawrence D'Oliveiro
    +* Re: GIL-Removal Project Takes Another Step (Posting On Python-List Prohibited)Greg Ewing
    |`* Re: GIL-Removal Project Takes Another Step (Posting On Python-List Prohibited)Chris Angelico
    | `- Re: GIL-Removal Project Takes Another Step (Posting On Python-List Prohibited)Paul Rubin
    `- Re: GIL-Removal Project Takes Another Step (Posting On Python-List Prohibited)Paul Rubin

1
GIL-Removal Project Takes Another Step (Posting On Python-List Prohibited)

<ut09ig$1umjo$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=29652&group=comp.lang.python#29652

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ldo@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.lang.python
Subject: GIL-Removal Project Takes Another Step (Posting On Python-List
Prohibited)
Date: Fri, 15 Mar 2024 01:51:12 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 37
Message-ID: <ut09ig$1umjo$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Fri, 15 Mar 2024 01:51:12 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="923cb71133c4c2bd336d691e5929520c";
logging-data="2054776"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/yZVB8wlkDWo3D+SsQEjE6"
User-Agent: Pan/0.155 (Kherson; fc5a80b8)
Cancel-Lock: sha1:yrIdFk4v2CcZ2T80e6bZlHxqpWc=
 by: Lawrence D'Oliv - Fri, 15 Mar 2024 01:51 UTC

Python takes another step in removing a major bottleneck to
multithreading performance
<https://devclass.com/2024/03/12/python-progresses-towards-faster-concurrency-option-to-disable-gil-merged-into-main-code/>.

Currently Python uses a combination of reference-counting and garbage
collection in order to avoid the need for programmers to have to keep
track of allocated objects and remembering when to dispose of them.
A pure garbage collection scheme, like in Java or LISP, makes it easier
to support multithreading, but at the cost of memory usage that can
easily get out of hand. Reference counting helps to ensure that objects
disappear as soon as the program forgets its last reference to them,
and this works well for most objects in a typical program, with garbage
collection as a fallback for cleaning up the rest.

But Python’s present scheme for maintaining reference counts (the
“Global Interpeter Lock” or “GIL”) prevents Python code for taking full
advantage of multiple threads. Some are advocating switching to the
pure garbage-collection approach, but fortunately (I think) this is not
the plan that has been adopted by the Council. Instead, they are going
to use a technique known as “Biased Reference Counting”. This splits
the reference count into two components, one managed by a thread which
is considered to “own” the object (and is presumably responsible for
most accesses to the object), while the other is managed on a shared
basis by other threads accessing the object (and making fewer accesses
to it). This seems to offer the best performance in tests so far.

The switchover is a complicated procedure, which is certain to have
implications for some existing Python code that never had to worry about
thread safety before, as well as far-reaching implications for the
design of the CPython implementation itself. So it will take place in
multiple stages over some years, and if worst comes to worst, the
changes can always be rolled back. (Or a different strategy chosen.)

Seems some people are still smarting over the flak they got from the
Python 2 → 3 transition. “This is not Python 4,” they are saying. But
why not call it “Python 4”, as a warning over the likely compatibility
issues? Even if it probably won’t be quite as painful ...

Re: GIL-Removal Project Takes Another Step (Posting On Python-List Prohibited)

<87v85jxepj.fsf@nightsong.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=29685&group=comp.lang.python#29685

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: no.email@nospam.invalid (Paul Rubin)
Newsgroups: comp.lang.python
Subject: Re: GIL-Removal Project Takes Another Step (Posting On Python-List Prohibited)
Date: Mon, 18 Mar 2024 17:11:52 -0700
Organization: A noiseless patient Spider
Lines: 48
Message-ID: <87v85jxepj.fsf@nightsong.com>
References: <ut09ig$1umjo$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Injection-Info: dont-email.me; posting-host="54763318fbe1fdbc46eb9810eb3d4e2e";
logging-data="472121"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1940YiR/swtaS6bYHG6hzqL"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
Cancel-Lock: sha1:+Z2V8J9vjwpVJ9I5rdU4m8QAK3c=
sha1:Zsd46LOGj3uiNwqZeiQKw+SrbPw=
 by: Paul Rubin - Tue, 19 Mar 2024 00:11 UTC

Lawrence D'Oliveiro <ldo@nz.invalid> writes:
> But Python’s present scheme for maintaining reference counts (the
> “Global Interpeter Lock” or “GIL”) prevents Python code for taking full
> advantage of multiple threads. Some are advocating switching to the
> pure garbage-collection approach, but fortunately (I think) this is not
> the plan that has been adopted by the Council.

I don't know the pro and anti GC arguments specifically in flight, so I
won't take a side here, but the idea that GC uses more memory seems
erroneous to me. MicroPython uses GC and runs in machines with as
little as 16KB of ram (the BBC Micro v1). I've used the CircuitPython
variant on chips with 32KB of ram and it is reasonably comfortable on
those. I don't think CPython has ever run on machines that small. GC
was invented in the 1950s for use in Lisp, on computers of that era that
were tiny compared with today's computers.

Classic GC adds one bit of overhead to each object, while reference
counting requires storing a refcount that is potentially large. A
strict refcounting approach in a big computer might even need 64 bit
refcounts. Also, the refcount has to be modified constantly. I'm
amazed if that doesn't slow things down badly even in the single
threaded case.

Also, the "with" statement was added to Python partly to support
GC-based implementations, as some applications were relying on
refcounting to release resources when the object went out of scope, a
bad kludge.

> Instead, they are going to use a technique known as “Biased Reference
> Counting”.

That sounds ugly but I'm far away from it so dunno.

> This seems to offer the best performance in tests so far.

They compared it to a serious GC and it won? If yes, that is
interesting.

> Seems some people are still smarting over the flak they got from the
> Python 2 → 3 transition. “This is not Python 4,” they are saying. But
> why not call it “Python 4”, as a warning over the likely compatibility
> issues? Even if it probably won’t be quite as painful ...

We seem to be getting a Python 4 transition (i.e. breaking old code)
with each new release of Python 3, so this is just more of the same.

Anyway I'm glad effort is being made to remove the GIL. If it were up
to me, I'd switch to BEAM or something like it as the underlying VM.

Re: GIL-Removal Project Takes Another Step (Posting On Python-List Prohibited)

<utati7$k004$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=29686&group=comp.lang.python#29686

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ldo@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.lang.python
Subject: Re: GIL-Removal Project Takes Another Step (Posting On Python-List
Prohibited)
Date: Tue, 19 Mar 2024 02:33:44 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 11
Message-ID: <utati7$k004$1@dont-email.me>
References: <ut09ig$1umjo$1@dont-email.me> <87v85jxepj.fsf@nightsong.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 19 Mar 2024 02:33:44 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="cf2257effda993e7401c0124f815988b";
logging-data="655364"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+qK3I25vbfHT7XZ+PAZ86k"
User-Agent: Pan/0.155 (Kherson; fc5a80b8)
Cancel-Lock: sha1:35ZWQ0ZemWyWcaXeDI04KFEspqU=
 by: Lawrence D'Oliv - Tue, 19 Mar 2024 02:33 UTC

On Mon, 18 Mar 2024 17:11:52 -0700, Paul Rubin wrote:

> ... the idea that GC uses more memory seems erroneous to me.

It will use whatever memory it is permitted to use.

Consider that every time you call a method, a new method-wrapper object is
dynamically created, and almost always immediately deleted when the call
returns. So even a very simple, seemingly well-behaved Python script, if
running for long enough, would consume more and more memory if it were not
for reference-counting.

Re: GIL-Removal Project Takes Another Step (Posting On Python-List Prohibited)

<87r0g5ybbp.fsf@nightsong.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=29688&group=comp.lang.python#29688

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: no.email@nospam.invalid (Paul Rubin)
Newsgroups: comp.lang.python
Subject: Re: GIL-Removal Project Takes Another Step (Posting On Python-List Prohibited)
Date: Tue, 19 Mar 2024 17:51:54 -0700
Organization: A noiseless patient Spider
Lines: 26
Message-ID: <87r0g5ybbp.fsf@nightsong.com>
References: <ut09ig$1umjo$1@dont-email.me> <87v85jxepj.fsf@nightsong.com>
<utati7$k004$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="cf0a57ecb12c7cb24f723587091c460e";
logging-data="1189805"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+0R4F+eMjDLdjc3xxpLRVw"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
Cancel-Lock: sha1:vjRluRPLkqCPnDanaIaXFb+cCXA=
sha1:Del5up3bPWrrqIOgS+CTEJsy2mI=
 by: Paul Rubin - Wed, 20 Mar 2024 00:51 UTC

Lawrence D'Oliveiro <ldo@nz.invalid> writes:
> So even a very simple, seemingly well-behaved Python script, if
> running for long enough, would consume more and more memory if it were
> not for reference-counting.

That is completely false. It's usual to set a GC to run every so-many
allocations. GHC normally does a minor GC every 256K of allocations so
that the most recent stuff fits in the L2 CPU cache, speeding things up
a lot. Refcounting schemes are of course incapable of that optimization
because they don't relocate objects in memory.

You can of course configure a GC to not run very often, in which case
the memory region can get large. That is an optimization you do
intentionally, to spend less CPU time doing GC, and of course you only
do that if you have the memory for it. I think you are imagining that
people always do that, but again remember MicroPython.

The allocation of a new method wrapper on every method call is of course
something that the interpreter could also be optimized to not do. The
Emacs Lisp interpreter does something like that for function args, IIRC.
They are passed on a permanent stack instead of in temporary cons cells.

Erlang on a midsized server can run millions of lightweight processes in
its VM, each with its own GC. The minimum ram size of an Erlang process
is around 2KB iirc. But I don't know if they get bigger than that
before the GC runs.

Re: GIL-Removal Project Takes Another Step (Posting On Python-List Prohibited)

<utdkb8$19g6t$4@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=29690&group=comp.lang.python#29690

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ldo@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.lang.python
Subject: Re: GIL-Removal Project Takes Another Step (Posting On Python-List
Prohibited)
Date: Wed, 20 Mar 2024 03:14:49 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 19
Message-ID: <utdkb8$19g6t$4@dont-email.me>
References: <ut09ig$1umjo$1@dont-email.me> <87v85jxepj.fsf@nightsong.com>
<utati7$k004$1@dont-email.me> <87r0g5ybbp.fsf@nightsong.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 20 Mar 2024 03:14:49 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="a3c7bb3811b3cbef9d335e33aa837a41";
logging-data="1360093"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+O2LrRpnV5tD/9Ln4fchCK"
User-Agent: Pan/0.155 (Kherson; fc5a80b8)
Cancel-Lock: sha1:Ja6S9y5yeXgT20wqG9QRJmENSdA=
 by: Lawrence D'Oliv - Wed, 20 Mar 2024 03:14 UTC

On Tue, 19 Mar 2024 17:51:54 -0700, Paul Rubin wrote:

> Lawrence D'Oliveiro <ldo@nz.invalid> writes:
>
>> So even a very simple, seemingly well-behaved Python script, if running
>> for long enough, would consume more and more memory if it were not for
>> reference-counting.
>
> That is completely false. It's usual to set a GC to [fix it so it’s not
> false] ...

In other words, it’s not “completely” false if you have to do something to
make it false. But that GC process creates its own overhead, not to
mention the latency when there isn’t quite enough memory for an allocation
and you have to wait until the next GC run to proceed. Run the GC a
thousand times a second, and the latency is still 1 millisecond.

With reference counting, most objects are immediately freed as soon as
they are discarded--no need to wait for the next GC run.

Re: GIL-Removal Project Takes Another Step (Posting On Python-List Prohibited)

<l5vhisFc622U1@mid.individual.net>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=29692&group=comp.lang.python#29692

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: greg.ewing@canterbury.ac.nz (Greg Ewing)
Newsgroups: comp.lang.python
Subject: Re: GIL-Removal Project Takes Another Step (Posting On Python-List
Prohibited)
Date: Wed, 20 Mar 2024 20:29:30 +1300
Lines: 15
Message-ID: <l5vhisFc622U1@mid.individual.net>
References: <ut09ig$1umjo$1@dont-email.me> <87v85jxepj.fsf@nightsong.com>
<utati7$k004$1@dont-email.me> <87r0g5ybbp.fsf@nightsong.com>
<utdkb8$19g6t$4@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: individual.net fOiuIuCiT0+DEkoOKI3fLgBOX/mT6ZmzCns1tv/tjdwe5pHWGy
Cancel-Lock: sha1:Yh1BSEIKjQGmJDkptd4mU/bd8XE= sha256:NAyFjtgAsppT2Zxcdxpl455Q3MYqUJZ79AJZMp3Pka0=
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:91.0)
Gecko/20100101 Thunderbird/91.3.2
Content-Language: en-US
In-Reply-To: <utdkb8$19g6t$4@dont-email.me>
 by: Greg Ewing - Wed, 20 Mar 2024 07:29 UTC

On 20/03/24 4:14 pm, Lawrence D'Oliveiro wrote:
> not to
> mention the latency when there isn’t quite enough memory for an allocation
> and you have to wait until the next GC run to proceed. Run the GC a
> thousand times a second, and the latency is still 1 millisecond.

That's not the way it usually works. If you run out of memory, you
run a GC there and then. You don't have to wait for GCs to occur on
a time schedule.

Also, as a previous poster pointed out, GCs are typically scheduled
by number of allocations, not by time.

--
Greg

Re: GIL-Removal Project Takes Another Step (Posting On Python-List Prohibited)

<mailman.120.1710920555.3452.python-list@python.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=29693&group=comp.lang.python#29693

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: rosuav@gmail.com (Chris Angelico)
Newsgroups: comp.lang.python
Subject: Re: GIL-Removal Project Takes Another Step (Posting On Python-List
Prohibited)
Date: Wed, 20 Mar 2024 18:42:21 +1100
Lines: 29
Message-ID: <mailman.120.1710920555.3452.python-list@python.org>
References: <ut09ig$1umjo$1@dont-email.me> <87v85jxepj.fsf@nightsong.com>
<utati7$k004$1@dont-email.me> <87r0g5ybbp.fsf@nightsong.com>
<utdkb8$19g6t$4@dont-email.me> <l5vhisFc622U1@mid.individual.net>
<CAPTjJmp5GXTU+4sDr+ZmuumCMyzVb=nqXu1GLJgrFp-hQ5Y16Q@mail.gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Trace: news.uni-berlin.de Xd3hiZ1etTG86/L1HylPNQk/9lEn9c8wxaV4GBQ+K6Pg==
Cancel-Lock: sha1:shjuz9ZNQ8thaoJggJGliPzY8GQ= sha256:KjMn7dOoY8Xhfibw6Tyng8g4DoesRl7iRdDZbjpy8D0=
Return-Path: <rosuav@gmail.com>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
reason="2048-bit key; unprotected key"
header.d=gmail.com header.i=@gmail.com header.b=BlLX69+X;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.019
X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; 'poster': 0.03; 'mar':
0.07; 'allocation': 0.09; 'schedule.': 0.09; 'then.': 0.09;
'typically': 0.09; 'subject:Python': 0.12; 'memory': 0.15; '2024':
0.16; 'chrisa': 0.16; 'cpython,': 0.16; 'from:addr:rosuav': 0.16;
'from:name:chris angelico': 0.16; 'generating': 0.16; 'greg':
0.16; 'subject:GIL': 0.16; 'wrote:': 0.16; 'probably': 0.17;
'pm,': 0.19; 'to:addr:python-list': 0.20; 'run': 0.23; 'normally':
0.26; "doesn't": 0.32; 'amounts': 0.32; 'python-list': 0.32;
'message-id:@mail.gmail.com': 0.32; 'but': 0.32; 'there': 0.33;
'header:In-Reply-To:1': 0.34; 'received:google.com': 0.34;
'from:addr:gmail.com': 0.35; 'request': 0.35; 'also,': 0.36;
"it's": 0.37; 'received:209.85': 0.37; 'way': 0.38;
'received:209': 0.39; 'quite': 0.39; 'enough': 0.39;
'received:209.85.208': 0.39; 'scheduled': 0.39; 'wed,': 0.39;
'still': 0.40; 'let': 0.66; 'time.': 0.66; 'subject:Project':
0.67; 'matter': 0.68; 'fyi': 0.69; 'responding': 0.69; 'times':
0.69; 'ignore': 0.71; 'subject:List': 0.71; 'out,': 0.78;
'thousand': 0.84; 'garbage': 0.84; 'subject:Posting': 0.84
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1710920553; x=1711525353; darn=python.org;
h=content-transfer-encoding:to:subject:message-id:date:from
:in-reply-to:references:mime-version:from:to:cc:subject:date
:message-id:reply-to;
bh=8n6hnn+5R1FlWXloLfo7pedtxU2fAwvsfex8Fe2lbLs=;
b=BlLX69+XiOFv0W7klKa3UzglhhRXcu9jSO2Op9doluQtleD4ktwVGSYZU0hNnAYd/B
jyfLhUH5sVXjCI68AJqYhRNsxH7zgs9QAIe44s911+Tz8WbjTGY1aKypeezU6KlaQO7D
+Ns9+hVajeUF8Bz0hCMXwLMmLfqPA7mljqcIS/6jHTgDb0cmEPMfs5IaSaNmo8by9/T6
ieHWX323W9uNHkPlyeiJFfETDVdyltAO+Dql5PFr6j30H3KkT4CHM1UWjWrCe9T8nZ/d
7F04HmD8pkRto8O7khEL52MQne9dT1JWgHjx0m9j+no1IpoBB5iC2GCuAh5qbx2qAQdV
Bwtw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1710920553; x=1711525353;
h=content-transfer-encoding:to:subject:message-id:date:from
:in-reply-to:references:mime-version:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to;
bh=8n6hnn+5R1FlWXloLfo7pedtxU2fAwvsfex8Fe2lbLs=;
b=QILrgYj0ntqEx/x3PdWb46SrMS9SC6qlgbviMeei587Q7abc5Nz3+X+zMBzDwTUozq
N5Ckf5rLBY4KJvGqw448sii0NTSADwyMEql2Eeg8TjcQrrobLnJYsFKdW9yJukgtlg/1
Ov2Qkkh2a4w7Z4TfU/pTMDI2iafdAGHeoAzgTwL62mhoUDqePDbsAPmfeHhAoKN2DcCU
QfyqFr2he0N7dLO/GJt+azsriKrjrqSkEPaAYF/pmGwfoES7r1wldXSwyywAb8SmwDs0
zkWt/EvMvCljVhY1mi+fKylbOYKX20Mpl8//A59m8ZwJdxTigISxn8f3xaJlUgmxSLWK
2doQ==
X-Gm-Message-State: AOJu0Yylfc6Ly8Rgs/LCNjUhmr+ykRobsHXABpdBFQcbgF4o2LD5EmM8
TIi2O1MS497Zi/qhx5b8LfXT+S3gv19j2f0n8uq+Mhn+c6+KXDVCs3sZrbhPxpGxwDjwkoxMZ+a
V5J+xFP7t1XxmRYV23Gaw9bb4MUoP64YN
X-Google-Smtp-Source: AGHT+IFUs8rzjcJr/fS5ieub6g0giREqhENq/cW02Dtj9oISY4USBx0nn2l9+xCkGmATqU9TTsWSwoJgT0pD+2346Xo=
X-Received: by 2002:a2e:874d:0:b0:2d2:af88:8947 with SMTP id
q13-20020a2e874d000000b002d2af888947mr11910714ljj.15.1710920552932; Wed, 20
Mar 2024 00:42:32 -0700 (PDT)
In-Reply-To: <l5vhisFc622U1@mid.individual.net>
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <CAPTjJmp5GXTU+4sDr+ZmuumCMyzVb=nqXu1GLJgrFp-hQ5Y16Q@mail.gmail.com>
X-Mailman-Original-References: <ut09ig$1umjo$1@dont-email.me>
<87v85jxepj.fsf@nightsong.com>
<utati7$k004$1@dont-email.me> <87r0g5ybbp.fsf@nightsong.com>
<utdkb8$19g6t$4@dont-email.me> <l5vhisFc622U1@mid.individual.net>
 by: Chris Angelico - Wed, 20 Mar 2024 07:42 UTC

On Wed, 20 Mar 2024 at 18:31, Greg Ewing via Python-list
<python-list@python.org> wrote:
>
> On 20/03/24 4:14 pm, Lawrence D'Oliveiro wrote:
> > not to
> > mention the latency when there isn’t quite enough memory for an allocation
> > and you have to wait until the next GC run to proceed. Run the GC a
> > thousand times a second, and the latency is still 1 millisecond.
>
> That's not the way it usually works. If you run out of memory, you
> run a GC there and then. You don't have to wait for GCs to occur on
> a time schedule.
>
> Also, as a previous poster pointed out, GCs are typically scheduled
> by number of allocations, not by time.
>

FYI you're violating someone's request by responding to them in a way
that results in it getting onto python-list, so it's probably safest
to just ignore cranks and trolls and let them stew in their own
juices.

But normally the GC doesn't need to be scheduled at all. In CPython,
the only reason to "run garbage collection" is to detect cycles, so
you would have to be generating inordinate amounts of cyclic garbage
for this to matter at all.

ChrisA

Re: GIL-Removal Project Takes Another Step (Posting On Python-List Prohibited)

<87edc5xpvv.fsf@nightsong.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=29694&group=comp.lang.python#29694

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: no.email@nospam.invalid (Paul Rubin)
Newsgroups: comp.lang.python
Subject: Re: GIL-Removal Project Takes Another Step (Posting On Python-List Prohibited)
Date: Wed, 20 Mar 2024 01:35:00 -0700
Organization: A noiseless patient Spider
Lines: 45
Message-ID: <87edc5xpvv.fsf@nightsong.com>
References: <ut09ig$1umjo$1@dont-email.me> <87v85jxepj.fsf@nightsong.com>
<utati7$k004$1@dont-email.me> <87r0g5ybbp.fsf@nightsong.com>
<utdkb8$19g6t$4@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Injection-Info: dont-email.me; posting-host="cf0a57ecb12c7cb24f723587091c460e";
logging-data="1479429"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX188HAIe9xj8FhTsiPqZ7NoG"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
Cancel-Lock: sha1:cdLT8gI9O3GcDN3mPl4DKoIJofI=
sha1:Mj1am0FRK624nR4JEI4P/g7dDIg=
 by: Paul Rubin - Wed, 20 Mar 2024 08:35 UTC

Lawrence D'Oliveiro <ldo@nz.invalid> writes:
> In other words, it’s not “completely” false if you have to do something to
> make it false.

No you don't have to do anything, it is false by default. In Java the
default GC interval is relatively small, and to make it bigger you use
the -XMx option iirc.

Remember we are talking about GIL removal to get speedups on multicore
processors. I expect any such processors these days

> But that GC process creates its own overhead

Refcounting has overhead too!

> not to mention the latency when there isn’t quite enough memory for an
> allocation and you have to wait until the next GC run to proceed.

If you are GC'ing every N allocations and you run out of free space
before you've done those N, you increase the region size by asking for
more memory from the system. If the system is out of memory, it is
out of memory and you need a bigger computer or some other change.
You don't "wait for the next GC run" as if it were a periodic daemon.

> With reference counting, most objects are immediately freed as soon as
> they are discarded--no need to wait for the next GC run.

In other words you effectively GC every time an object is freed instead
of having a tuneable parameter that you can optimize. And of course you
don't get freedom from pauses either. If you allocate a million element
list in Python, then drop the last reference to the list, you have to
decrement the refcounts of each of the million elements, however long
that takes. Plus if that decrements most or all of them to zero, you
have to free them one by one. With a copying-style GC, you never have
to visit those elements or free them individually.

Look, widely used GC'd languages include Java, SBCL and other comparable
Lisp systems, GHC, OCaml, Erlang, .NET (C# and F#), Golang, current
incarnations of Javascript, and others. All of them beat the pants off
of CPython in performance. If you're claiming CPython's refcounting
system somehow outperforms the above mentioned GC's, I'd be interested
in seeing some benchmarks. There may be some trade-offs in CPython that
make its refcount system still advantageous for some things, but
performance is unlikely to be one.

Re: GIL-Removal Project Takes Another Step (Posting On Python-List Prohibited)

<87a5mtxpr5.fsf@nightsong.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=29695&group=comp.lang.python#29695

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: no.email@nospam.invalid (Paul Rubin)
Newsgroups: comp.lang.python
Subject: Re: GIL-Removal Project Takes Another Step (Posting On Python-List Prohibited)
Date: Wed, 20 Mar 2024 01:37:50 -0700
Organization: A noiseless patient Spider
Lines: 13
Message-ID: <87a5mtxpr5.fsf@nightsong.com>
References: <ut09ig$1umjo$1@dont-email.me> <87v85jxepj.fsf@nightsong.com>
<utati7$k004$1@dont-email.me> <87r0g5ybbp.fsf@nightsong.com>
<utdkb8$19g6t$4@dont-email.me> <l5vhisFc622U1@mid.individual.net>
<CAPTjJmp5GXTU+4sDr+ZmuumCMyzVb=nqXu1GLJgrFp-hQ5Y16Q@mail.gmail.com>
<mailman.120.1710920555.3452.python-list@python.org>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="cf0a57ecb12c7cb24f723587091c460e";
logging-data="1479429"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18QBzGwPqDvjWZXLnqGLcrj"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
Cancel-Lock: sha1:KaOMKAiQjS+5A6hzIVh9TQjRdJw=
sha1:MJsFI8HO9ADQt6AsJzi6IQP5v/o=
 by: Paul Rubin - Wed, 20 Mar 2024 08:37 UTC

Chris Angelico <rosuav@gmail.com> writes:
> FYI you're violating someone's request by responding to them in a way
> that results in it getting onto python-list,

I don't know if I'm doing that, but if yes, it's not on purpose. I'm
responding on Usenet.

> In CPython, the only reason to "run garbage collection" is to detect
> cycles

That's the current version. We're discussing the possibility of
switching from refcounting to a GC system as part of the GIL removal
project.

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor