Re: Cocoa's custom class delegate conventions
Re: Cocoa's custom class delegate conventions
- Subject: Re: Cocoa's custom class delegate conventions
- From: Wade Tregaskis <email@hidden>
- Date: Sat, 14 Jun 2003 19:55:33 +1000
I've been told that there is some other "magic" optimization done in
Cocoa,
but I don't know what it is. Something about caching the selectors?
There is a mechanism for this, yes. If you look at any object in the
debugger, it has a cache var. I haven't been able to figure out the
data format of it, but basically it's some sort of mini-hash table into
which the last dozen or so functions used are placed, based on their
selector. Thus, calling one of these cached selectors means doing a
quick lookup in this table, versus crawling the instance's full
function table (or however it's done).
I imagine there must be a trade off between caching and just looking up
each call, because a poor cache will mean you don't get the speed
improvements from it, but do get the overhead of checking it for each
call. It might be interesting if Apple provide a mechanism to control
caching on an object, such that you could fine tune it for your
individual uses. But then again, that probably opens up a whole big
can of worms, even if it is possible.
Wade Tregaskis
-- Sed quis custodiet ipsos custodes?
_______________________________________________
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.