[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: NSOrderedSet implementation
From: |
David Chisnall |
Subject: |
Re: NSOrderedSet implementation |
Date: |
Thu, 1 Aug 2013 08:49:26 +0100 |
If anyone feels like hacking on collection classes...
Over the last week I did some profiling, and the overwhelming majority of
NS[Mutable]Dictionaries that are created have only NSString subclasses as keys.
We'd almost certainly see some improvement if these were to use some kind of
trie-derived data structure indexed by characters internally, rather than a
hash table, although the cost of inserting a non-string key would be relatively
large (as it would require copying everything into a hash table).
David
On 1 Aug 2013, at 07:48, Eric Wasylishen <address@hidden> wrote:
> Hi Luboš,
> I started implementing NSOrderedSet but got distracted with some other
> things.
>
> My current idea is to use a combination of an NSMutableArray, and a
> NSMapTable configured to map objects to integers. The idea is that the array
> maps the object's index to the object, and the map table maps objects to
> their index.
>
> I have some untested code that illustrates the idea here:
> http://svn.gna.org/svn/etoile/trunk/Etoile/Frameworks/CoreObject/Sandbox/COWeakMutableOrderedSet.m
>
> This is just a NSMutableOrderedSet subclass where I wanted weak references,
> but I think we could use the same code for a concrete GSMutableOrderedSet
> subclass. Btw, those are all of the primitive methods for NSOrderedSet /
> NSMutableOrderedSet according to the Foundation release notes.
>
> Eric
>
> On 2013-07-23, at 3:45 AM, Luboš Doležel <address@hidden> wrote:
>
>> Hi,
>>
>> gnustep-base currently lacks NSOrderedSet.
>>
>> Before I set to work, does gnustep-base include any primitives that could
>> be/should be used for this? This seems to be a case for a binary tree.
>>
>> --
>> Luboš Doležel
>>
>>
>> _______________________________________________
>> Gnustep-dev mailing list
>> address@hidden
>> https://lists.gnu.org/mailman/listinfo/gnustep-dev
>
> _______________________________________________
> Gnustep-dev mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/gnustep-dev
-- Sent from my Difference Engine