Re: NSKeyedArchiver finishEncoding takes forever
Re: NSKeyedArchiver finishEncoding takes forever
- Subject: Re: NSKeyedArchiver finishEncoding takes forever
- From: Markus Spoettl <email@hidden>
- Date: Wed, 18 Jun 2008 15:37:30 -0700
On Jun 18, 2008, at 2:50 PM, Quincey Morris wrote:
I suppose you could byte-move each group of 4 doubles in one NSData
and give that to the archiver instead. Or do it further upstream and
make a bigger array of numbers in a NSData. (But you'll have to deal
with endianness and -- egads! -- floating point representation
issues across architectures yourself.)
Perhaps you could avoid the endianness and representation issues by
archiving each group of 4 doubles (with a different archive object)
into a NSData and give that to your main archiver. This sounds like
it would be slow, but probably not as slow as what you already tried.
I just tried this. It is slower than saving XML (around 10 seconds),
which is orders of magnitudes faster than without this "optimization".
One problem is that each 4 double value object gets blown up to 307
bytes when in its NSData container. That makes the overall file
increase from 18MB to 38MB. That's a bit of a problem and compressing
the data won't make things faster, so that's not an option.
I'll try the further upstream approach, it should lower the memory
impact but I will pay for that with much slower performance - I'll
report back how that turns out.
Probably the real answer is that NSKeyedArchiver isn't designed to
handle such large numbers of objects efficiently.
It's more like "lots of numbers" rather than "lots of objects". It
doesn't matter whether the doubles are located in separate objects or
not. Iit would be nice to see a warning in the documentation if such a
design limitation really exists - it may be a bug.
Anyway thanks for your input!
Regards
Markus
--
__________________________________________
Markus Spoettl
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
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