Re: Keyword @defs
Re: Keyword @defs
- Subject: Re: Keyword @defs
- From: Ben Haller <email@hidden>
- Date: Mon, 30 Nov 2009 18:44:26 -0500
On 30-Nov-09, at 5:52 PM, Mike Abdullah wrote:
On 30 Nov 2009, at 21:33, Ben Haller wrote:
What I want is essentially a struct with methods; I need super-fast
access to ivars for clients of the class in some places in my
code. But I also want functionality provided by the class itself
via methods, and I want a class hierarchy (so just using functions
instead of methods gets ugly fast). Is there a better solution
than @public? Or is there some reason I shouldn't worry about it
-- is all the overhead just on the first pass through any given
code path, with back-patching, for example?
I realize the dangers of breaking encapsulation, etc. :-> But
sometimes optimization simply demands that you do such things. I
run my app on a computing cluster, and time on the cluster is at a
premium, so the headaches involved are worth it. I just want to
know the best way to do it, given these recent changes to Objective-
C. Any advice?
Could your class perhaps expose a struct or a pointer to it as a
property of some kind? You are avoiding touching instance variables,
and once the method to retrieve the struct is used, you can cache
the result. Or even, expose the struct as an instance variable,
giving the speed advantage of both.
That's an interesting idea, Mike. I think I will look into it.
Thanks (and thanks too to Greg Parker for his also illuminating post)!
Ben Haller
Stick Software
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden