discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using NS[Int]Number for dictionary keys


From: Richard Frith-Macdonald
Subject: Re: Using NS[Int]Number for dictionary keys
Date: Wed, 31 Aug 2005 10:37:46 +0100

On 2005-08-30 19:38:13 +0100 Mark Dalrymple <bork@borkware.com> wrote:

Greetings,

I'm working with some folks that are wanting to put a large number of objects into a dictionary, keyed by number. When using string keys created with

     string1 = [NSString stringWithFormat:@"%d", clauseNumber];
     [clauseHashTable setObject:currentClause forKey:string1];

with clauseNumber going from 1 to a bit over 1 million, It takes about 6 seconds (2-way G5 running OS X) to populate a dictionary.

When using NSNumbers,

      number = [NSNumber numberWithInt: clauseNumber];
      [clauseHashTable setObject: currentClause
                       forKey: number];

It takes about 21 minutes. Using the same code with Apple's Cocoa libraries takes about 3 seconds.

Lousy hash implementation for NSNumber ... I have replaced it in CVS with a better one.






reply via email to

[Prev in Thread] Current Thread [Next in Thread]