• 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: Newbie Q:Considerations/Techniques for Saving Large Amounts of Data
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Newbie Q:Considerations/Techniques for Saving Large Amounts of Data


  • Subject: Re: Newbie Q:Considerations/Techniques for Saving Large Amounts of Data
  • From: Glen Low <email@hidden>
  • Date: Sat, 31 Jan 2004 08:54:59 +0800

My question is this, without implementing a database, how can I write
large data files to disk efficiently? Read below for more details.

I have a few applications which need to save thousands of objects in
arrays. What's more, is that each time the user uses the program they
will likely add more objects to different arrays, making the data
structure larger and larger and thus writing the file to disk will take
longer and longer.

I have noticed that iCal saves events as soon as the user creates them,
to a .ics file, but you never notice it saving. Maybe they have another
thread do the saving, or maybe there is a way to just re-write part of
the file?

Any thoughts, help or tips are most welcome.

You could try memory-mapped files. Basically the OS treats a disk file as if it were main memory, taking care of reading, writing and buffering the data. OS X has the UNIX function mmap (C API) which does this, and NSData has a dataWithContentsOfMappedFile: method. There are some caveats, mainly that the data should be self-contained, and the memory layout should be identical to the disk layout (otherwise there is no advantage). I don't think you can simply stuff ObjC objects with efficiency into a memory-mapped file.

Cheers, Glen Low


---
pixelglow software | simply brilliant stuff
www.pixelglow.com
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Newbie Q:Considerations/Techniques for Saving Large Amounts of Data (From: "Ian G. Gillespie" <email@hidden>)
 >Re: Newbie Q:Considerations/Techniques for Saving Large Amounts of Data (From: Philip Mötteli <email@hidden>)

  • Prev by Date: Re: NSArrayController Funkyness
  • Next by Date: Flickery NSAlertPanel
  • Previous by thread: Re: Newbie Q:Considerations/Techniques for Saving Large Amounts of Data
  • Next by thread: NSMenu leak when connected to outlet with interface builder?
  • Index(es):
    • Date
    • Thread