[Python-3000] A better way to initialize PyTypeObject

Fredrik Lundh fredrik at pythonware.com
Wed Nov 29 21:32:17 CET 2006


Talin wrote:

> Now, I tend to prefer using a static table vs. the 
> function-call-per-method simply because of my habits, which tend to be 
> overly parsimonious with code size and such (It's a side-effect of 
> working on embedded systems, which is what game consoles effectively 
> are.) I wouldn't have strong objections to doing it the other way.

Umm.  AFAICT, a call with one variable and two constant arguments 
typically needs 16-20 bytes on x86; a four-item struct with a pointer to 
a string literal needs 16 bytes plus the string literal, which means 
that you're restricted to 3-character names if you don't want to waste 
memory...

...and the decoder will of course be a lot larger, uglier, and slower
if it has to test for a whole bunch of strings constants instead just 
switching on an integer value.  Bloat alert.

</F>



More information about the Python-3000 mailing list