• 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: Reading in dictionary from txt file: options for speed
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Reading in dictionary from txt file: options for speed


  • Subject: Re: Reading in dictionary from txt file: options for speed
  • From: Kyle Sluder <email@hidden>
  • Date: Tue, 14 Apr 2009 19:18:48 -0400

On Tue, Apr 14, 2009 at 7:09 PM, Michael Ash <email@hidden> wrote:
> This is not so. It's extremely rare to find a platform which
> *requires* aligned access, and you certainly won't find one running OS
> X. What's more common is finding a platform which *prefers* aligned
> access, punishing misaligned access with significantly slower
> operation. Even in those cases, "misaligned" means using an address
> that isn't a multiple of your data type's size. Since char is always
> one byte by definition, it is impossible to have a misaligned char
> pointer.

x64 requires certain alignments:
http://software.intel.com/en-us/articles/data-alignment-when-migrating-to-64-bit-intel-architecture/

I originally had the length member as an integer, which is why I was
concerned about alignment.  I modified it at the last minute because
it makes the pointer math easier and I can't imagine a prefix that
requires more than 255 characters.  The code I pasted is pretty
roundabout anyway; I'm not recommending that anyone use it, I just
wanted to convey my idea.

Another consideration I didn't take into account is that the iPhone
uses solid-state storage, whereas the kind of optimization I was
recommending (read in the entire file) is mostly beneficial on
mechanical disks.  It also helps circumvent buffered IO--when you know
you need the whole file anyway, there's no point in having the kernel,
the C runtime, and potentially Foundation buffer your (sequential)
reads.

--Kyle Sluder
_______________________________________________

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: Reading in dictionary from txt file: options for speed
      • From: Michael Ash <email@hidden>
References: 
 >Reading in dictionary from txt file: options for speed (From: Miles <email@hidden>)
 >Re: Reading in dictionary from txt file: options for speed (From: Kyle Sluder <email@hidden>)
 >Re: Reading in dictionary from txt file: options for speed (From: Michael Ash <email@hidden>)

  • Prev by Date: Re: Reading in dictionary from txt file: options for speed
  • Next by Date: Re: Reading in dictionary from txt file: options for speed
  • Previous by thread: Re: Reading in dictionary from txt file: options for speed
  • Next by thread: Re: Reading in dictionary from txt file: options for speed
  • Index(es):
    • Date
    • Thread