Re: Does Python Need Virtual Threads? (Posting On Python-List Prohibited)

Lawrence D'Oliveiro <[email protected]> Tue, 17 Jun 2025 02:12:03 -0000 (UTC)
Newsgroups comp.lang.python
Organization A noiseless patient Spider
Message-ID <[email protected]>
On Sun, 15 Jun 2025 21:02:46 -0700, Paul Rubin wrote:

> I'd be interested in seeing some benchmarks of multi-threaded Python
> beating Erlang, if you have any to show.

Since you ask, I tried running up a simple program that creates lots of 
dummy threads that do nothing but sleep for a few seconds, and reports on 
its RAM usage by reading /proc/self/statm.

I am currently up to a bit over 25,000 threads (the default limit is 
somewhere just under 26,000). The program reports its VM usage as over 
200GB, which is way more than my total RAM + swap space, but in fact the 
free(1) command reports that RAM and swap usage are nowhere that high. The 
resident RAM usage while all the threads are running is reported at about 
430MB.

In other words, multiply that by 40, and a million threads should get the 
program’s RAM usage up to maybe 18GB.