Re: objective-c / cocoa efficiency
Re: objective-c / cocoa efficiency
- Subject: Re: objective-c / cocoa efficiency
- From: Mike Ferris <email@hidden>
- Date: Wed, 9 Mar 2005 07:20:52 -0800
If TextExtras has any extra efficiency I would doubt that it comes from any choice of function vs. method... The grnaularity of the code is just not small enough for that to make much difference here. (It can make a difference in much smaller-grained situations).
TextExtras does try to be efficient in a number of places by minimizing memory allocation and so forth.
My guess is that in most practical cases, at least, this is not necessarily a huge win in the brace matching. Sometimes I get carried away with avoiding allocation. (Although often that is important!)
Objective-C code often has this kind of optimization in it. As Annard said, it is best only to do this sort of thing after discovering through actual measurement that there is a need. But plenty of the code in Cocoa is somewhat gnarly on the inside in order to be fast. The trick (and one that Obj-C generally allows and Cocoa generally achieves) is to not yet the gnarliness leak out where clients of your API can see it and have to deal with it...
Mike Ferris
Begin forwarded message:
From: b a r t o n <email@hidden>
Date: March 9, 2005 1:46:20 AM PST
To: email@hidden
Subject: Re: objective-c / cocoa efficiency
Reply-To: email@hidden
Annard,
Thanks for that - I actually looked at TextExtras early on and while
it does work very nicely it is not as readable as the objective-c.
Does it really cost that much more to use these objects? I mean the
whole window system is already using Cocoa and one can not circumvent
that with C - there must be a reason for that.
Barton
On Wed, 9 Mar 2005 10:14:06 +0100, Annard Brouwer <email@hidden> wrote:
Hello Barton,
On 9 Mar 2005, at 00:31, b a r t o n wrote:
Here is the implementation diff - tell me what you think.
FYI there is code in TextExtras that does a similar lookup for matching
braces but then using a less ObjC-heavy approach using C functions. You
may want to look at that to see an alternative implementation. And it's
written by someone who knows NSText et al. very, very well...
For my XMLTagInputManager, I took that approach and it worked well
enough...
Cheers,
Annard
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden