Re: [Python-Dev] PEP for new dictionary implementation

2012-02-19 Thread Martin v. Löwis
>> Ah, now I understand; you do need a single ssize_t either on the dict >> or at the head of the values array to indicate how many slots it has >> actually allocated. It *may* also be worthwhile to add a second >> ssize_t to indicate how many are currently in use, for faster results >> in case of

Re: [Python-Dev] PEP for new dictionary implementation

2012-02-17 Thread Mark Shannon
On 17 February 2012 at 17:42 Jim Jewett wrote: > On Fri, Feb 17, 2012 at 1:50 AM, "Martin v. Löwis" wrote: > >>> Good idea. However, how do you track per-dict how large the > >>> table is? > > [Or, rather, what is the highest index needed to store any values > that are actually set for this ins

Re: [Python-Dev] PEP for new dictionary implementation

2012-02-17 Thread Jim Jewett
On Fri, Feb 17, 2012 at 1:50 AM, "Martin v. Löwis" wrote: >>> Good idea. However, how do you track per-dict how large the >>> table is? [Or, rather, what is the highest index needed to store any values that are actually set for this instance.] > To determine whether it needs to grow the array, i

Re: [Python-Dev] PEP for new dictionary implementation

2012-02-17 Thread Antoine Pitrou
On Fri, 17 Feb 2012 13:10:51 + Mark Shannon wrote: > On 16/02/12 20:45, Antoine Pitrou wrote: > > > > On Wed, 08 Feb 2012 19:18:14 + > > Mark Shannon wrote: > >> Proposed PEP for new dictionary implementation, PEP 410? > >> is attached. > >> > > > > So, I'm running a few benchmarks using

Re: [Python-Dev] PEP for new dictionary implementation

2012-02-17 Thread Mark Shannon
On 16/02/12 20:45, Antoine Pitrou wrote: On Wed, 08 Feb 2012 19:18:14 + Mark Shannon wrote: Proposed PEP for new dictionary implementation, PEP 410? is attached. So, I'm running a few benchmarks using Twisted's test suite (see https://bitbucket.org/pitrou/t3k/wiki/Home). At the end of

Re: [Python-Dev] PEP for new dictionary implementation

2012-02-16 Thread Martin v. Löwis
>> Good idea. However, how do you track per-dict how large the table is? > > Why would you want to? > > The per-instance array needs to be at least as large as the highest > index used by any key for which it has a value; if the keys table gets > far larger (or even shrinks), that doesn't really

Re: [Python-Dev] PEP for new dictionary implementation

2012-02-16 Thread Jim Jewett
On Thu, Feb 16, 2012 at 4:34 PM, "Martin v. Löwis" wrote: > Am 16.02.2012 19:24, schrieb Jim J. Jewett: >> PEP author Mark Shannon wrote >> (in >> http://mail.python.org/pipermail/python-dev/attachments/20120208/05be469a/attachment.txt): >>> ... allows ... (the ``__dict__`` attribute of an obje

Re: [Python-Dev] PEP for new dictionary implementation

2012-02-16 Thread Martin v. Löwis
Am 16.02.2012 19:24, schrieb Jim J. Jewett: > > > PEP author Mark Shannon wrote > (in > http://mail.python.org/pipermail/python-dev/attachments/20120208/05be469a/attachment.txt): > >> ... allows ... (the ``__dict__`` attribute of an object) to share >> keys with other attribute dictionaries of

Re: [Python-Dev] PEP for new dictionary implementation

2012-02-16 Thread Martin v. Löwis
Am 13.02.2012 13:46, schrieb Mark Shannon: > Revised PEP for new dictionary implementation, PEP 412? > is attached. Committed as PEP 412. Regards, Martin ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-d

Re: [Python-Dev] PEP for new dictionary implementation

2012-02-16 Thread Martin v. Löwis
Am 11.02.2012 22:22, schrieb Mark Shannon: > Antoine Pitrou wrote: >> Hello Mark, >> >> I think the PEP should explain what happens when a keys table needs >> resizing when setting an object's attribute. > > If the object is the only instance of a class, it remains split, > otherwise the table is

Re: [Python-Dev] PEP for new dictionary implementation

2012-02-16 Thread Antoine Pitrou
On Wed, 08 Feb 2012 19:18:14 + Mark Shannon wrote: > Proposed PEP for new dictionary implementation, PEP 410? > is attached. > So, I'm running a few benchmarks using Twisted's test suite (see https://bitbucket.org/pitrou/t3k/wiki/Home). At the end of `python -i bin/trial twisted.internet.t

[Python-Dev] PEP for new dictionary implementation

2012-02-16 Thread Jim J. Jewett
PEP author Mark Shannon wrote (in http://mail.python.org/pipermail/python-dev/attachments/20120208/05be469a/attachment.txt): > ... allows ... (the ``__dict__`` attribute of an object) to share > keys with other attribute dictionaries of instances of the same class. Is "the same class" a delibe

Re: [Python-Dev] PEP for new dictionary implementation

2012-02-13 Thread Mark Shannon
Revised PEP for new dictionary implementation, PEP 412? is attached. Cheers, Mark. PEP: XXX Title: Key-Sharing Dictionary Version: $Revision$ Last-Modified: $Date$ Author: Mark Shannon Status: Draft Type: Standards Track Content-Type: text/x-rst Created: 08-Feb-2012 Python-Version: 3.3 or 3.4 P

Re: [Python-Dev] PEP for new dictionary implementation

2012-02-11 Thread Mark Shannon
Antoine Pitrou wrote: Hello Mark, I think the PEP should explain what happens when a keys table needs resizing when setting an object's attribute. If the object is the only instance of a class, it remains split, otherwise the table is combined. Most OO code will set attributes in the __init__

Re: [Python-Dev] PEP for new dictionary implementation

2012-02-11 Thread Antoine Pitrou
Hello Mark, I think the PEP should explain what happens when a keys table needs resizing when setting an object's attribute. Reading the implementation, it seems the sharing can disappear definitely, which seems a bit worrying. Regards Antoine. On Wed, 08 Feb 2012 19:18:14 + Mark Shannon

Re: [Python-Dev] PEP for new dictionary implementation

2012-02-08 Thread Mark Shannon
Terry Reedy wrote: On 2/8/2012 2:18 PM, Mark Shannon wrote: A pretty clear draft PEP. Changes to repr() output and iteration order: For most cases, this will be unchanged. However for some split-table dictionaries the iteration order will change. Neither of these cons should be a problem. Mod

Re: [Python-Dev] PEP for new dictionary implementation

2012-02-08 Thread Terry Reedy
On 2/8/2012 2:18 PM, Mark Shannon wrote: A pretty clear draft PEP. Changes to repr() output and iteration order: For most cases, this will be unchanged. However for some split-table dictionaries the iteration order will change. Neither of these cons should be a problem. Modules which meddle wi

[Python-Dev] PEP for new dictionary implementation

2012-02-08 Thread Mark Shannon
Proposed PEP for new dictionary implementation, PEP 410? is attached. Cheers, Mark. PEP: XXX Title: Key-Sharing Dictionary Version: $Revision$ Last-Modified: $Date$ Author: Mark Shannon Status: Draft Type: Standards Track Content-Type: text/x-rst Created: 08-Feb-2012 Python-Version: 3.3 or 3.4 P