Re: Native Cocoa vs Java performance question
Re: Native Cocoa vs Java performance question
- Subject: Re: Native Cocoa vs Java performance question
- From: Bill Bumgarner <email@hidden>
- Date: Fri, 11 Apr 2003 17:14:56 -0400
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.