Optimizing Object Instantiation (was Re: How Fast Does Python Run?)

Mark Hammond mhammond at skippinet.com.au
Sun Jun 18 00:14:28 EDT 2000


"Sam Penrose" <see at message.body> wrote in message
news:see-0F7889.18054217062000 at news.dnai.com...

> 1) Does informed opinion agree that object instantiation is
> noticeably performance-expensive in CPython? (Unfortunately,
> I can't seem to find the article in question.)

Sorry - no informed opinions here :-)

But I would guess that "type" creation (ie, creation of objects
implemented in extension modules) would be quite fast, and mainly
dependent on the native malloc() speed.

I could well believe that "instance" creation (ie, creation of user
defined class instances) would be quite slow, especially if the object in
question has an __init__ function!

Mark.






More information about the Python-list mailing list