• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: fast search of NSPointerArray
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: fast search of NSPointerArray


  • Subject: Re: fast search of NSPointerArray
  • From: James Maxwell <email@hidden>
  • Date: Sat, 22 Jun 2013 20:25:53 -0700

It's a mixed graph structure. Basically, I'm storing all unique nodes in an NSMutableArray, then using NSPointerArrays to build the adjacency lists. It works really nicely for learning/building the graph, but it does seem as though searches are a little slower. My guess is that this is because I'm now iterating over a lot of null values (which I wasn't before). But, as Graham says, I should really verify this before going any further with altering the data structures...

J.


On 2013-06-22, at 8:10 PM, Ken Thomases <email@hidden> wrote:

> On Jun 22, 2013, at 9:56 PM, James Maxwell wrote:
>
>> I've recently been working on an optimized version of a pretty complex project. The big problem before was memory usage, and I'm happy to say that I've tackled that really well. However, in order to do this I switched from using NSMutableDictionaries to sparse NSPointerArrays. On the down side, I'm finding that the new build is a little bit slower -- an outcome I really didn't expect. Thinking through it a bit, it occurred to me that it may be because my data structures are now sparse arrays, with the data stored by index, and thus generally contain a fairly large number of null values. I'm thinking that my iterations may have slowed down because of the sparseness. Is there some decent way around this?
>>
>> I've thought creating my sparse arrays using NSHashTable (keyed by NSIntegers) instead of NSPointerArray. Does this seem like a reasonable way to speed things up?
>
> It's really hard to say.  You should probably start at the high level and ask about data structures and algorithms that can achieve the sort of memory-time tradeoff you want.  What is it that you're trying to achieve?
>
> Regards,
> Ken
>


_______________________________________________

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


  • Follow-Ups:
    • Re: fast search of NSPointerArray
      • From: Keary Suska <email@hidden>
References: 
 >fast search of NSPointerArray (From: James Maxwell <email@hidden>)
 >Re: fast search of NSPointerArray (From: Ken Thomases <email@hidden>)

  • Prev by Date: Re: fast search of NSPointerArray
  • Next by Date: Re: Why is it wrong to have relationships without an inverse in Core Data?
  • Previous by thread: Re: fast search of NSPointerArray
  • Next by thread: Re: fast search of NSPointerArray
  • Index(es):
    • Date
    • Thread