Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

Immortality consists largely of boredom. -- Zefrem Cochrane, "Metamorphosis", stardate 3219.8


devel / comp.lang.python / Re: What's the public API alternative to _PyObject_GC_IS_TRACKED()?

SubjectAuthor
o Re: What's the public API alternative to _PyObject_GC_IS_TRACKED()?Dieter Maurer

1
Re: What's the public API alternative to _PyObject_GC_IS_TRACKED()?

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

  copy mid

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

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: dieter@handshake.de (Dieter Maurer)
Newsgroups: comp.lang.python
Subject: Re: What's the public API alternative to _PyObject_GC_IS_TRACKED()?
Date: Wed, 29 Dec 2021 10:06:23 +0100
Lines: 20
Message-ID: <mailman.59.1640768787.3079.python-list@python.org>
References: <CABbU2U89U=itsPwsU8+POREYMCf9F3U=_CciwVO0ynCAJ0aFcQ@mail.gmail.com>
<CC507B7F-0A6C-415A-952E-2C7CDC75C9EC@barrys-emacs.org>
<CABbU2U9JLyt=7Up81sry7HV+4OyyZ23hZ=i1fxpGk-Y+_zhNaA@mail.gmail.com>
<25035.38873.999288.900094@ixdm.fritz.box>
<CABbU2U-pqXeu6Ezoz09TDzANrSs+VfHT9cCFzP2xy5zLOcM6qQ@mail.gmail.com>
<25036.6260.111047.628470@ixdm.fritz.box>
<CABbU2U8AwOi7wTDH4yPO=NW61hoTF2DuU203d4Ss7rg1i7VJwg@mail.gmail.com>
<CABbU2U-Dv+=4eMP8mHxhyRTOWC21Q2bJiEaC8PG12fDSVVg5zw@mail.gmail.com>
<25036.9487.982997.883611@ixdm.fritz.box>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Trace: news.uni-berlin.de 5sSPB2MxTnfKlu87lVjfCAUYc8zvWwdJLAmr/NSTFIaA==
Return-Path: <dieter@handshake.de>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=none reason="no signature";
dkim-adsp=none (unprotected policy); dkim-atps=neutral
X-Spam-Status: OK 0.123
X-Spam-Level: *
X-Spam-Evidence: '*H*': 0.76; '*S*': 0.00; 'subject:API': 0.07;
'cc:addr:python-list': 0.09; 'smaller': 0.09; 'trivial': 0.09;
'cc:name:python list': 0.16; 'dict': 0.16; 'large.': 0.16;
'subject:()?': 0.16; 'implement': 0.19; 'cc:addr:python.org':
0.20; 'cc:2**1': 0.23; 'received:de': 0.23; 'extension': 0.25;
'>>>': 0.28; 'version.': 0.28; 'think': 0.32; 'but': 0.32; "i'll":
0.33; 'header:In-Reply-To:1': 0.34; 'complex': 0.35; 'definitely':
0.35; 'cases': 0.36; 'class': 0.37; 'means': 0.38; 'wrote': 0.39;
'still': 0.40; 'subject:What': 0.40; 'above': 0.62; 'pass': 0.64;
'becomes': 0.64; 'overall': 0.64; 'your': 0.64;
'header:Received:6': 0.67; 'per': 0.68; 'times': 0.69; '....':
0.76; 'highly': 0.78; 'received:88': 0.84; 'sulla': 0.84; 'thus,':
0.84
In-Reply-To: <CABbU2U-Dv+=4eMP8mHxhyRTOWC21Q2bJiEaC8PG12fDSVVg5zw@mail.gmail.com>
X-Mailer: VM 8.0.12-devo-585 under 21.4 (patch 24) "Standard C" XEmacs Lucid
(x86_64-linux-gnu)
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: <25036.9487.982997.883611@ixdm.fritz.box>
X-Mailman-Original-References: <CABbU2U89U=itsPwsU8+POREYMCf9F3U=_CciwVO0ynCAJ0aFcQ@mail.gmail.com>
<CC507B7F-0A6C-415A-952E-2C7CDC75C9EC@barrys-emacs.org>
<CABbU2U9JLyt=7Up81sry7HV+4OyyZ23hZ=i1fxpGk-Y+_zhNaA@mail.gmail.com>
<25035.38873.999288.900094@ixdm.fritz.box>
<CABbU2U-pqXeu6Ezoz09TDzANrSs+VfHT9cCFzP2xy5zLOcM6qQ@mail.gmail.com>
<25036.6260.111047.628470@ixdm.fritz.box>
<CABbU2U8AwOi7wTDH4yPO=NW61hoTF2DuU203d4Ss7rg1i7VJwg@mail.gmail.com>
<CABbU2U-Dv+=4eMP8mHxhyRTOWC21Q2bJiEaC8PG12fDSVVg5zw@mail.gmail.com>
 by: Dieter Maurer - Wed, 29 Dec 2021 09:06 UTC

Marco Sulla wrote at 2021-12-29 09:29 +0100:
>On second thought, I think I'll do this for the pure py version. But I
>will definitely not do this for the C extension

Are you sure you need to implement your type in C at all?

I made a small `timeit` test:
```
>>> class cd(dict): pass
....
>>> timeit("d[1]", "d={1:1}", globals=globals())
0.02474160000019765
>>> timeit("d[1]", "d=cd({1:1})", globals=globals())
0.08281239100051607
```
This means that for the above trivial case, access is 3.5 times slower
(the difference is smaller for more complex cases when hashing
becomes more expensive) but it is still only 83 ns per access.
Thus, if your application is not highly dominated by dict accesses,
the overall difference will not be large.


devel / comp.lang.python / Re: What's the public API alternative to _PyObject_GC_IS_TRACKED()?

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor