On Fri, Aug 15, 2008 at 17:31, Christian Heimes <[EMAIL PROTECTED]> wrote:
> Robert Kern wrote:
>> I think you could make the dictionary created lazily on the first getattr().
>
> In order to make it work you have to reserve space for a PyObject*
> pointer for the instance dict somewhere in your type definition. It's
> going to increase the size of every object by 4 bytes on a 32bit OS or 8
> bytes on a 64bit OS, aka sizeof(uintptr_t). An empty dict increases the
> size of every object by ~30 byte.

Yes, we know that. The concern I was addressing was the time overhead
for creating the new dict object every time an ndarray gets
instantiated. Most of these dict objects would be unused, so we would
be wasting a substantial amount of time. If you push off the creation
of the dict to the first time the user accesses it, then we're not
wasting any time. We do realize that space for the pointer must still
be reserved.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
 -- Umberto Eco
_______________________________________________
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to