• 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: NSKeyedArchiver finishEncoding takes forever
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSKeyedArchiver finishEncoding takes forever


  • Subject: Re: NSKeyedArchiver finishEncoding takes forever
  • From: "Mark Munz" <email@hidden>
  • Date: Sat, 21 Jun 2008 23:46:50 -0700

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@hidden> 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 (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
>



--
Mark Munz
unmarked software
http://www.unmarked.com/
_______________________________________________

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: NSKeyedArchiver finishEncoding takes forever
      • From: Markus Spoettl <email@hidden>
References: 
 >NSKeyedArchiver finishEncoding takes forever (From: Markus Spoettl <email@hidden>)
 >Re: NSKeyedArchiver finishEncoding takes forever (From: "Michael Ash" <email@hidden>)
 >Re: NSKeyedArchiver finishEncoding takes forever (From: Markus Spoettl <email@hidden>)
 >Re: NSKeyedArchiver finishEncoding takes forever (From: Quincey Morris <email@hidden>)
 >Re: NSKeyedArchiver finishEncoding takes forever (From: Markus Spoettl <email@hidden>)
 >Re: NSKeyedArchiver finishEncoding takes forever (From: "Michael Ash" <email@hidden>)
 >Re: NSKeyedArchiver finishEncoding takes forever (From: Markus Spoettl <email@hidden>)

  • Prev by Date: [Q] How to add a program as a login item after installing?
  • Next by Date: Re: NSKeyedArchiver finishEncoding takes forever
  • Previous by thread: Re: NSKeyedArchiver finishEncoding takes forever
  • Next by thread: Re: NSKeyedArchiver finishEncoding takes forever
  • Index(es):
    • Date
    • Thread