Le 1 nov. 08 à 09:31, Oleg Krupnov a écrit :

In my app all model data are saved in a single file. For the purpose
of optimizing file I/O, I'm looking for a solution that would not
force me to resave the entire model when only a tiny bit of it has
changed, and also allow loading (fetching) the model only partially -
lazily upon request.

A solution for this problem could be saving different parts of the
model in different archive files using
NSKeyedArchiver/NSKeyedUnarchiver. However, this only works when there
are no cross-references between the parts of the model that need to be
saved. AFAIU, upon loading, any saved cross-reference would create a
new copy of the object that would not map to the same model object. Is
there a work around this problem?

Another solution that seems feasible is a kind of file mapping into
memory, i.e. there is a single large file but accessed randomly like
memory. However, I am not sure there is such thing in Cocoa and also
if it really gives any performance gain.

File mapping can be performed using standards libc functions, and you can also use -[NSData initWithContentsOfMappedFile:] I don't know if it solve your problem, but with that, you will be able to perform some tests.

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to