Re: NSMapTable with C strings as keys
Re: NSMapTable with C strings as keys
- Subject: Re: NSMapTable with C strings as keys
- From: Jean-Daniel Dupas <email@hidden>
- Date: Thu, 30 May 2013 10:07:20 +0200
Le 30 mai 2013 à 08:35, Eric Wing <email@hidden> a écrit :
> On 5/29/13, Jens Alfke <email@hidden> wrote:
>>
>> On May 29, 2013, at 8:29 PM, Eric Wing <email@hidden> wrote:
>>
>>> CFDictionary I did not formally do in the benchmark, but I did run on
>>> the side for curiosity. I found that the C-string to CFString
>>> conversion ended up putting it at the bottom of the list in terms of
>>> performance.
>>
>> It seems unfair to include the C-string-to-object conversion time in the
>> benchmark, if what you’re trying to measure is hash-table performance. Did
>> you include that in the benchmarks for the other languages too? (And using
>> real Unicode-savvy string objects — I know Python has both types)?
>>
>> —jens
>
> In my introduction, I was fairly adamant that time lost to impedance
> mis-match should be measured because my interest was real performance
> in using these libraries for projects based in C. That conversion time
> is non-trivial.
>
> And yes, all languages I benchmarked had to go through the same rules
> (i.e. deal with const char*). This is why C++ std::string actually did
> not fare so well compared to some of the other languages. (And the
> magical optimizer did not come to the rescue.) For Python, I was not
> aware of Unicode vs. other APIs. Since the focus was C, I wasn't
> really thinking about Unicode. I used PyDict_SetItemString to insert a
> string (the source code is linked on that page somewhere).
>
I follow Jens on this one. Nothing prevent you to use CFDictionary with a C string directly or any other type.
You don't have to create CFString.
-- Jean-Daniel
_______________________________________________
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