• 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 hash of NSData?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Fast hash of NSData?


  • Subject: Re: Fast hash of NSData?
  • From: Graham Cox <email@hidden>
  • Date: Sat, 30 Nov 2013 11:37:57 +0100

On 30 Nov 2013, at 12:41 am, Kyle Sluder <email@hidden> wrote:

> That’s not a good idea. If the file on disk changes out from under you, the cache no longer reflects the data.

That can’t happen - the image data is embedded in the file stream at the moment, not held as a separate file. While I intend to change to that at some point, I don’t do it now. When I do, I’ll also (have to) change the way that the image references in the main stream are written. So the hash approach is only really a stop-gap - it gets me better performance without changing the basic architecture.

@Scott Ribe:

> I recently (last week, no kidding) investigated this question, and went with murmur hash.



I went with a 64-bit FNV-1a, which looks on a par with murmur, according to the page linked by Eric: http://programmers.stackexchange.com/questions/49550/which-hashing-algorithm-is-best-for-uniqueness-and-speed. Which admittedly I am taking at face value, having only profiled my own code for speed, not randomness, etc. The main reason being that an implementation of FNV-1a was right there on the page :)

—Graham





_______________________________________________

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 hash of NSData?
      • From: Mike Abdullah <email@hidden>
References: 
 >Fast hash of NSData? (From: Graham Cox <email@hidden>)
 >Re: Fast hash of NSData? (From: Kyle Sluder <email@hidden>)
 >Re: Fast hash of NSData? (From: Graham Cox <email@hidden>)
 >Re: Fast hash of NSData? (From: Kyle Sluder <email@hidden>)
 >Re: Fast hash of NSData? (From: Graham Cox <email@hidden>)
 >Re: Fast hash of NSData? (From: Graham Cox <email@hidden>)
 >Re: Fast hash of NSData? (From: Kyle Sluder <email@hidden>)

  • Prev by Date: Re: Download fileSystem data
  • Next by Date: Re: Fast hash of NSData?
  • Previous by thread: Re: Fast hash of NSData?
  • Next by thread: Re: Fast hash of NSData?
  • Index(es):
    • Date
    • Thread