[Python-Dev] cpython: hashtable.h now supports keys of any size (original) (raw)

Serhiy Storchaka storchaka at gmail.com
Wed Mar 23 13:37:31 EDT 2016


On 21.03.16 23:01, victor.stinner wrote:

https://hg.python.org/cpython/rev/aca4e9af1ca6 changeset: 100640:aca4e9af1ca6 user: Victor Stinner <victor.stinner at gmail.com> date: Mon Mar 21 22:00:58 2016 +0100 summary: hashtable.h now supports keys of any size

Issue #26588: hashtable.h now supports keys of any size, not only sizeof(void*). It allows to support key larger than sizeof(void*), but also to use less memory for key smaller than sizeof(void*).

If key size is compile time constant, Py_MEMCPY() and memcpy() can be optimized in one machine instruction. If it is ht->key_size, it adds more overhead. These changes can have negative performance effect.

It can be eliminated if pass a compile time constant to _Py_HASHTABLE_ENTRY_READ_KEY() etc.



More information about the Python-Dev mailing list