Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

Science may someday discover what faith has always known.


devel / comp.lang.python / Re: Python threading comparison

SubjectAuthor
o Re: Python threading comparisonChris Angelico

1
Re: Python threading comparison

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

  copy mid

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

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!4.us.feeder.erje.net!2.eu.feeder.erje.net!feeder.erje.net!fu-berlin.de!uni-berlin.de!not-for-mail
From: rosuav@gmail.com (Chris Angelico)
Newsgroups: comp.lang.python
Subject: Re: Python threading comparison
Date: Wed, 23 Jun 2021 06:15:29 +1000
Lines: 33
Message-ID: <mailman.142.1624392942.4164.python-list@python.org>
References: <CAGGBd_q-Ugyz4_GduOkUburgvi9JedfGo1-1SbJCks6x6r9NPA@mail.gmail.com>
<CAPTjJmpqTWTe8ZLOSV-uwactRGxXUU-4iRAZaA15GdDiDeNeRg@mail.gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
X-Trace: news.uni-berlin.de xjbaDxjnJFdTCalEuItz7AwemMlWREAYpsfPv+o+1fCQ==
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=ovgPSfhB;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.003
X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; '(which': 0.04; 'anymore.':
0.09; 'dan': 0.09; 'graph': 0.09; 'identical': 0.09; 'itself,':
0.09; 'other.': 0.09; 'threads': 0.09; 'subject:Python': 0.12;
'benefiting': 0.16; 'chrisa': 0.16; 'comparison,': 0.16;
'cpython': 0.16; 'cpython,': 0.16; 'from:addr:rosuav': 0.16;
'from:name:chris angelico': 0.16; 'if,': 0.16; 'independent,':
0.16; 'integer': 0.16; 'interesting,': 0.16; 'iterate': 0.16;
'micropython': 0.16; 'mistaken,': 0.16; 'runtime': 0.16;
'threading': 0.16; 'turns': 0.16; 'wrote:': 0.16; 'python': 0.16;
'it?': 0.18; 'basically': 0.23; 'object': 0.23; "i'd": 0.23;
'to:addr:python-list': 0.23; 'course.': 0.27; 'jun': 0.27; 'bit':
0.28; 'single': 0.28; 'but': 0.31; 'shared': 0.31; "doesn't":
0.32; "i'm": 0.32; '23,': 0.32; 'objects': 0.32; 'message-
id:@mail.gmail.com': 0.33; 'received:209.85.166': 0.33; 'header
:In-Reply-To:1': 0.33; 'same': 0.34; 'received:google.com': 0.34;
'from:addr:gmail.com': 0.35; 'at:': 0.37; 'way': 0.37;
'received:209.85': 0.38; 'hard': 0.38; 'others': 0.38;
'received:209': 0.38; 'put': 0.39; 'means': 0.40; 'main': 0.40;
'pretty': 0.40; 'completely': 0.60; 'range': 0.64; 'once': 0.64;
'instead,': 0.65; 'plus': 0.68; 'affected': 0.71; 'low': 0.71;
'global': 0.72; 'performance': 0.74; 'little': 0.75; 'read,':
0.75; 'poor': 0.77; 'potentially': 0.77; 'well!': 0.77; '2021':
0.84; 'benefits.': 0.84
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
h=mime-version:references:in-reply-to:from:date:message-id:subject:to;
bh=tOcULMgvGjW+M/ml9L6YvR7NydCPmv3EwflOW6PWHKA=;
b=ovgPSfhB1eNAhw/s1ER4RvEXtqW/pw+dbG2BkPUhV+KKyzoUwoiBg562mCeBam1oqq
7AzOKfu2q7OjrTTB5HsSF7zVkzEH3cCIJYvhzh+8vNlmZ2OJMOPSR8gn4XkM5NREWQ5G
wZ4zBeC6mmhQxDuUDjiKmscR0zEjsUWGpggP4nBqvNa1LJeBsSx37+2ZxN4AdIlWAn/c
0XjiukvsfbZZm/k9/DekfHd7+SmgEdMtxUfz6O1WbjRRDFl8nhhwiVEhQuAzVXKY9gbt
ypbevGFw/r/gF7/oYWz0PBf0nYhVH+ZZbZyiyjfK8k/hckfbOEy8R6W9jLfE684F7Xfj
7+uQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20161025;
h=x-gm-message-state:mime-version:references:in-reply-to:from:date
:message-id:subject:to;
bh=tOcULMgvGjW+M/ml9L6YvR7NydCPmv3EwflOW6PWHKA=;
b=mYbs/nspi36ZionPhwdEy4yJ9HKHv9Am0o+BEg6MVcfSUwLJRhKsPupQSOOkRueJ6+
E4lngbqTIPYvsKCMqpsXpF2rRak+L/jWwmLy/kMDcp/8yI8KYc9RW6vYR0HjldnHUKhL
cPSQdJx+/GyzrEXUWrB52TIcvNxZBfc6hMwwdQkdz+wm6yrUSy4jy4sDGORmlnelNJ30
xP/7h+WgoxgJCy+NbLVXsynVVZimkP7LZ4mL/0mzhux/CQp03sZkjVmoWFgb/UEEvoJR
78AB08VHWjBzXHW1fd3yjFt2EkDfnW0qthEYN1TPrnlDRXMkAhWhO4XIRnVcFjXM8623
H8UA==
X-Gm-Message-State: AOAM530FAO98h7TQafU/VUxFx7fSDoBg2/0WPthZZclS4DF+2vKgYHEu
84OyjWSnlDwh/T7dvLem4G+hzfzZoQ7OZBn/o/IwiiR0
X-Google-Smtp-Source: ABdhPJyTpaG8J7JKYIAwlebyyKzqeUshphUO2DISY3VYn7BVD0LV5xplMWqxNQN6hUam3VUqVhvV0ksE/ttem/BKIcM=
X-Received: by 2002:a02:cd21:: with SMTP id h1mr5591361jaq.114.1624392940007;
Tue, 22 Jun 2021 13:15:40 -0700 (PDT)
In-Reply-To: <CAGGBd_q-Ugyz4_GduOkUburgvi9JedfGo1-1SbJCks6x6r9NPA@mail.gmail.com>
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.34
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: <CAPTjJmpqTWTe8ZLOSV-uwactRGxXUU-4iRAZaA15GdDiDeNeRg@mail.gmail.com>
X-Mailman-Original-References: <CAGGBd_q-Ugyz4_GduOkUburgvi9JedfGo1-1SbJCks6x6r9NPA@mail.gmail.com>
 by: Chris Angelico - Tue, 22 Jun 2021 20:15 UTC

On Wed, Jun 23, 2021 at 5:34 AM Dan Stromberg <drsalists@gmail.com> wrote:
>
> I put together a little python runtime comparison, with an embarallel,
> cpu-heavy threading microbenchmark.
>
> It turns out that the performance-oriented Python implementations, Pypy3
> and Nuitka3, are both poor at threading, as is CPython of course.
>
> On the plus side for CPython, adding cpu-heavy threads doesn't cause
> performance to get significantly worse anymore.
>
> The pleasant result is that Micropython threads pretty well!
>
> There's a graph of the performance curves at:
> https://stromberg.dnsalias.org/~strombrg/python-thread-comparison/

The legend's collided with some of the graph itself, making it a bit
hard to read, but if I'm not mistaken, you have CPython and Nuitka
basically identical and worst, and then PyPy much faster but not
benefiting from threads, and uPy as the only one that benefits.

So what that means is that uPy has a completely different
threading/locking model, which is interesting, but all the others are
basically just behaving the same way as each other.

I'd be curious to know how this would be affected if the threads had a
small amount of shared data. Once they get into their main work
(summing a range), they're completely independent, apart from
potentially sharing integer objects in the low range (which will be
completely insignificant in the stats). What if, instead, you create a
single global range object and all the threads iterate over it?

ChrisA


devel / comp.lang.python / Re: Python threading comparison

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor