some comments for Python 3000

Rainer Deyke root at rainerdeyke.com
Sun Aug 13 20:07:00 EDT 2000


"Courageous" <jkraska1 at san.rr.com> wrote in message
news:3996F17F.BE84F0CB at san.rr.com...
> Your average Python program is outperformed by C by 6:1 and
> in some cases this is worse. It's an issue.

Much worse, in fact.  In some cases, C outperforms Python by over 100:1.
And memory usage is even worse.  In C, I can have a integer variable with
range 0 to 255 in a single byte.  In Python, I need at least two objects
(the integer and the string that holds the integer's name), both allocated
on the stack (with whatever overhead this entails), both with four bytes
reference count and four bytes pointer to the type object, plus the contents
which are again at least four bytes each, plus one byte for each character
in the variable name - and that isn't counting the extra storage needed for
the entry in the dictionary (another eight bytes on average at least).
That's worse than 64:1.  Even if the C version uses four bytes for the
integer, it's 16:1.


--
Rainer Deyke (root at rainerdeyke.com)
Shareware computer games           -           http://rainerdeyke.com
"In ihren Reihen zu stehen heisst unter Feinden zu kaempfen" - Abigor





More information about the Python-list mailing list