Re: NSMapTable with C strings as keys
Re: NSMapTable with C strings as keys
- Subject: Re: NSMapTable with C strings as keys
- From: Eric Wing <email@hidden>
- Date: Wed, 29 May 2013 23:35:49 -0700
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).
Since I also did integer hash benchmarks, you can get an idea of pure
hashing performance from those benchmarks since there is little
conversion overhead in most of those cases. (The exception is Perl
which seems to convert everything to strings which I did not expect.)
-Eric
--
Beginning iPhone Games Development
http://playcontrol.net/iphonegamebook/
_______________________________________________
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