[Python-Dev] More compact dictionaries with faster iteration (original) (raw)
Serhiy Storchaka storchaka at gmail.com
Mon Dec 10 10:12:27 CET 2012
- Previous message: [Python-Dev] More compact dictionaries with faster iteration
- Next message: [Python-Dev] More compact dictionaries with faster iteration
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 10.12.12 09:48, Christian Heimes wrote:
On the other hand every lookup and collision checks needs an additional multiplication, addition and pointer dereferencing:
entry = entriesbaseaddr + sizeof(PyDictKeyEntry) * idx
I think that main slowdown will be in getting index from array with variable size of elements. It requires conditional jump which is not such cheap as additional or shifting.
switch (self->index_size) {
case 1: idx = ((uint8_t *)self->indices)[i]; break;
case 2: idx = ((uint16_t *)self->indices)[i]; break;
...
}
I think that variable-size indices don't worth effort.
- Previous message: [Python-Dev] More compact dictionaries with faster iteration
- Next message: [Python-Dev] More compact dictionaries with faster iteration
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]