... but I'm curious.

Hi Guido,

while working on Psyco, I stumbled over a log entry in modsupport.h:


   19-Aug-2002  GvR     1012    Changes to string object struct for
                                interning changes, saving 3 bytes.


The change to stringobject was this  (rev. 28308):

Before:
typedef struct {
    PyObject_VAR_HEAD
    long ob_shash;
    PyObject *ob_sinterned;
    char ob_sval[1];
} PyStringObject;

After:
typedef struct {
    PyObject_VAR_HEAD
    long ob_shash;
    int ob_sstate;
    char ob_sval[1];
} PyStringObject;

Now, the internals are very clear to me. What I don't understand
is where the three saved bytes should be.

Thinking of the time where this change was made, I cannot imagine
that this comment was about the size diff between pointer and int,
and if this was meant, I still don't get how this could save three
bytes?

With unaligned ob_sval, structure packing and ob_sstate being
unsigned char one could save 3 bytes, but we don't do that.

Well, as said, this is no important question. I am just asking
myself what I don't see here, or if the comment is just sub-optimal :-)

all the best -- chris


p.s.: won't make it to PyCon this time, see you soon at the piggies
--
Christian Tismer             :^)   <mailto:tis...@stackless.com>
tismerysoft GmbH             :     Have a break! Take a ride on Python's
Johannes-Niemeyer-Weg 9A     :    *Starship* http://starship.python.net/
14109 Berlin                 :     PGP key -> http://wwwkeys.pgp.net/
work +49 30 802 86 56  mobile +49 173 24 18 776  fax +49 30 80 90 57 05
PGP 0x57F3BF04       9064 F4E1 D754 C2FF 1619  305B C09C 5A3B 57F3 BF04
      whom do you want to sponsor today?   http://www.stackless.com/
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to