Re: Native Cocoa vs Java performance question
Re: Native Cocoa vs Java performance question
- Subject: Re: Native Cocoa vs Java performance question
- From: Sheehan Olver <email@hidden>
- Date: Fri, 11 Apr 2003 16:30:47 -0500
Hmm, I was under the impression that CF* and NS* are indistinguishable,
i.e. they are bit-for-bit equivalent. If I was correct, this would mean
that the implementation of a CF Function could poke right in to the
data structure in a c-like manor as opposed to just making message
calls anyways. Of course, I may be wrong. I agree with the rest of the
message, but the point was that it was working fine speed wise in java,
and any architectural problem would most likely affect both C and
Objective-C. Maybe this is just one of the cases where java is faster
(Java is very much geared towards database and server side stuff, while
cocoa is geared towards gui, so I wouldn't be surprised if this was the
case. I haven't heard any comparsions with the CF* objects themselves,
so maybe they are faster.)
On Friday, April 11, 2003, at 04:14 PM, Bill Bumgarner wrote:
On Friday, Apr 11, 2003, at 01:00 US/Eastern,
email@hidden wrote:
I did want to suggest that you try
casting the NSMutableDictionary to a CFMutableDictionary (not sure if
thats the correct name). Then you can use the equivalent C functions
instead of sending messages. Assuming these functions are not
implemented with Objective-C, this could result in significant speed
up, and probably faster than java at max optimization. Plus, I believe
the CF classes are Open Source, so your program would be theoretically
cross platform.
Just wanted to post a quick comment on this...
Casting an NSMutableDitionary to a CFDictionary and using the C API to
manipulate the dictionary contents may not actually gain any
performance beyond the initial method-now-function call.
The point of the "no cost bridging" between CF* and NS* types is to
allow either to be used transparently on either side of the bridge.
If you pass an NS* type into a CF* function, there may still be a
flurry of method calls as the NS* type is used within the CF*
implementation.
If you really want to use CF* API to accelerate your code, you should
create the data holder-- the object, for all intents and purposes--
via the CF* API. That is, use CFCreateMutableDictionary() [or
whatever it is] to create the dictionary -- not NSMutableDictionary.
That will ensure-- hopefully-- that the internal implementation will
be as pure CF* as possible, thereby avoiding Objective-C messaging as
much as possible.
Of course, all of this is said while avoiding the reality that:
- you should never go down this path unless you have determined
that there really is a performance issue that can be addressed by
avoiding messaging. Very rare that this is actually the case.
- you have done everything possible to optimize the code already
on the object graph side of things. That is, you have optimized the
data management code to avoid unnecessary updates, unnecessary graph
traversals, etc... It is far more likely that performance issues are
related to these kinds of issues.
b.bum
_______________________________________________
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.