diff options
author | Tim Peters <tim.peters@gmail.com> | 2006-05-30 04:16:25 (GMT) |
---|---|---|
committer | Tim Peters <tim.peters@gmail.com> | 2006-05-30 04:16:25 (GMT) |
commit | 9b10f7e0cbacad9be6375f0e6dbf70cf18574e6b (patch) | |
tree | 000aabf5a76a04c9166578c1c8c22363c1ae8d12 /Include | |
parent | 1e44ca94acc5e93ab21aacded7046ee5171c40cd (diff) | |
download | cpython-9b10f7e0cbacad9be6375f0e6dbf70cf18574e6b.zip cpython-9b10f7e0cbacad9be6375f0e6dbf70cf18574e6b.tar.gz cpython-9b10f7e0cbacad9be6375f0e6dbf70cf18574e6b.tar.bz2 |
Convert relevant dict internals to Py_ssize_t.
I don't have a box with nearly enough RAM, or an OS,
that could get close to tickling this, though (requires
a dict w/ at least 2**31 entries).
Diffstat (limited to 'Include')
-rw-r--r-- | Include/dictobject.h | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/Include/dictobject.h b/Include/dictobject.h index c917782..fd3d1fc 100644 --- a/Include/dictobject.h +++ b/Include/dictobject.h @@ -8,7 +8,7 @@ extern "C" { /* Dictionary object type -- mapping from hashable object to object */ /* The distribution includes a separate file, Objects/dictnotes.txt, - describing explorations into dictionary design and optimization. + describing explorations into dictionary design and optimization. It covers typical dictionary use patterns, the parameters for tuning dictionaries, and several ideas for possible optimizations. */ @@ -48,7 +48,11 @@ meaning otherwise. #define PyDict_MINSIZE 8 typedef struct { - long me_hash; /* cached hash code of me_key */ + /* Cached hash code of me_key. Note that hash codes are C longs. + * We have to use Py_ssize_t instead because dict_popitem() abuses + * me_hash to hold a search finger. + */ + Py_ssize_t me_hash; PyObject *me_key; PyObject *me_value; } PyDictEntry; @@ -65,14 +69,14 @@ it's two-thirds full. typedef struct _dictobject PyDictObject; struct _dictobject { PyObject_HEAD - int ma_fill; /* # Active + # Dummy */ - int ma_used; /* # Active */ + Py_ssize_t ma_fill; /* # Active + # Dummy */ + Py_ssize_t ma_used; /* # Active */ /* The table contains ma_mask + 1 slots, and that's a power of 2. * We store the mask instead of the size because the mask is more * frequently needed. */ - int ma_mask; + Py_ssize_t ma_mask; /* ma_table points to ma_smalltable for small tables, else to * additional malloc'ed memory. ma_table is never NULL! This rule |