[Python-Dev] 64-bit process optimization 1 (original) (raw)

Tim Peters tim.one@comcast.net
Mon, 09 Sep 2002 14:16:18 -0400


[Guido]

... So perhaps the refcnt should have been a long in the first place.

We agreed to that years ago, but never bothered to change it. In fact, you used to tell people it was a long until I beat that out of you .

Do note that a long is still only 4 bytes on Win64. The type we really want here is what pyport.h calls Py_intptr_t (a Python spelling of the appropriate C99 type; C99 introduced ways to say what you really mean in these cases).

A similar argument may hold for the length of e.g. strings and lists: one could wish to have a list of more than 2 billion elements, or a string containing more than 2 gigabytes (that much RAM is easily found on the larger 64-bit servers, I believe).

Opinions?

Those are more naturally addressed by size_t, since strlen and malloc are constrained to that type. I generally declare string-slinging code as using size_t vars now, and endure the pain of casting back and forth to int to talk with Python's idea of a string size.

Whether it's worth the pain to change this stuff depends on whether we think 64-bit boxes are just another passing fad like the Internet .