Re: CFDictionary callback on PPC vs Intel
Re: CFDictionary callback on PPC vs Intel
- Subject: Re: CFDictionary callback on PPC vs Intel
- From: "Michael Ash" <email@hidden>
- Date: Sun, 17 Feb 2008 11:59:43 -0500
On Feb 17, 2008 11:43 AM, Derrek Leute <email@hidden> wrote:
> The project actually started in cocoa but I moved to CF because
> NSDictionary forces a string copy for keys. This made memory needs go
> through the roof (unless I'm misusing or misunderstanding how to use
> it). CF lets me use anything as a key. In some sense I would love to
> be in Cocoa as I had to reimplement NSSet intersection and some other
> little basic things to do this. But it's fast, and it seems to be
> working quite well now. Not to mention that pointer comparison also
> seemed ridiculously faster on this amount of data.
Check out toll free bridging:
http://www.cocoadev.com/index.pl?TollFreeBridging
In short, a lot of CF types are equivalent to their NS types and can
be "converted" simply by casting. I put "converted" in quotes because
no conversion takes place; the same object is simultaneously an NS
object and a CF object.
Note that a CFDictionary created with custom callbacks will still copy
its keys if you use -setObject:forKey:, so don't do that. But
otherwise you can take a CFSet and use NSSet methods, you can put
NSNumbers in your CFDictionaries, and so forth. As far as I know, all
custom callbacks will be respected aside from NSDictionary insisting
on creating copies of the keys.
Mike
_______________________________________________
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