Re: Speed Traps
Re: Speed Traps
- Subject: Re: Speed Traps
- From: Marcel Weiher <email@hidden>
- Date: Tue, 20 May 2003 02:40:12 +0200
On Monday, May 19, 2003, at 10:27 Uhr, Tom Sutcliffe wrote:
It is "very different" in that the difference is ONLY not all that
noticeable if you use NSObject's brain-dead refcount implementation,
which is in itself several times slower than an inline reference
count (almost 10 times for an optimized inline refcount). The reason
it is so slow is that every refcount operation requires a hash lookup
and possibly allocation/deallocation of the slot for the
extra-refcount inserted into the table. Nobody in their right mind
uses that, certainly Apple doesn't. All Apple-provided classes use
some sort of inline refcount.
I'm intrigued as to why NSObject uses hashes at all in its reference
counting, especially if all the classes Apple have produced don't.
Could you clarify this?
The reason is simple: NSObject has no place for an inline reference
count. If you look at the definition of NSObject's instance variables,
there is just the 'isa' pointer (pointing to the class). All the other
objects have more instance variables, and the inline reference count is
usually 'tucked away' in the same workd as some other values/flags.
I am not 100% sure, but it looks to me that Apple didn't want to
'waste' a full word by defining the inline reference count in NSObject.
It would have been a full word if it was defined there, because there
is nothing else that NSObject needs that could share the same word of
memory.
Regards,
Marcel
--
Marcel Weiher Metaobject Software Technologies
email@hidden www.metaobject.com
Metaprogramming for the Graphic Arts. HOM, IDEAs, MetaAd etc.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.