I also recommend logging a bug with Apple against this issue. You shouldn't need to jump through those sorts of hoops with NSKeyedArchiver.
On Wed, Jun 18, 2008 at 8:48 PM, Markus Spoettl <[EMAIL PROTECTED]> wrote: > On Jun 18, 2008, at 2:41 PM, Michael Ash wrote: >> >> Although it partially defeats the purpose of using NSCoder, you'll >> avoid this whole path if you stuff all four doubles into a single >> NSData. Don't forget to use the byte-swapping functions to ensure that >> they all have a consistent representation across architectures. > > > Well, what can I say, you and Quincey Morris are absolutely right. This is > the way to go. > > The same data set takes just 4 seconds to store with a file size of 17.2MB. > > Thanks for all the help guys! For the record I'm posting the code below. > > Regards > Markus > > - (void)encodeDouble:(double)value forKey:(NSString *)key withCoder:(NSCoder > *)encoder > { > NSSwappedDouble sd = NSSwapHostDoubleToLittle(value); > [encoder encodeBytes:(const uint8_t *)&sd length:sizeof(NSSwappedDouble) > forKey:key]; > } > > - (double)decodeDoubleForKey:(NSString *)key withCoder:(NSCoder *)decoder > { > double result = 0.0; > NSUInteger retsize; > NSSwappedDouble *sd = (NSSwappedDouble *)[decoder decodeBytesForKey:key > returnedLength:&retsize]; > if (retsize == sizeof(NSSwappedDouble)) { > result = NSSwapLittleDoubleToHost(*sd); > } > return result; > } > > -- > __________________________________________ > Markus Spoettl > > > _______________________________________________ > > 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/unmarked%40gmail.com > > This email sent to [EMAIL PROTECTED] > -- Mark Munz unmarked software http://www.unmarked.com/ _______________________________________________ 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]