[issue31954] Don't prevent dict optimization by coupling with OrderedDict

INADA Naoki report at bugs.python.org
Tue Nov 7 04:11:08 EST 2017


INADA Naoki <songofacandy at gmail.com> added the comment:

I don't know why dk_lookup is in dictkeys object.  But I think
it's because sharing 1 word from all key-sharing dict.
So ma_clean flag can be in dictkeys object for same reason.

BTW, We use dk_lookup function pointer and it tooks 1 word.
But PyPy use flags for it.  So they can pack other informations into same word.

static dict_lookup_func lookup_funcs = {lookdict_unicode_nodummy, lookdict_unicode, lookdict_split, lookdict};
...
    unsigned int ma_clean:1;
    unsigned int ma_lookup_func:2; // lookup_funcs[ma_lookup_func]
...

In this way, we can have more flags for future optimization.
(e.g. "all keys are interned string and comparing pointer is enough for searching interned key" flag).

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue31954>
_______________________________________


More information about the Python-bugs-list mailing list