Re: Improve performance of data structure saved to disk
Re: Improve performance of data structure saved to disk
- Subject: Re: Improve performance of data structure saved to disk
- From: Juanjo Conti <email@hidden>
- Date: Fri, 07 Aug 2015 00:33:32 -0300
I was calling archive a lot of times! Changing that really improve
performance.
Thanks!
On Thu, Aug 6, 2015 at 9:09 PM, Graham Cox <email@hidden> wrote:
>
> > With only 350 objects you should be fine using a ‘dumb’ archived
> dictionary. I’ve used that approach for several thousand objects that were
> more complex than cookies; this was on a Mac, but it was back in 2004 so it
> was probably slower than today’s iPhones ;-)
> >
> >> I detect the performance issue using Instruments to mesure CPU time. The
> >> heaviest call from my call resulted to [CookieKey encodeWithCoder:]
> >
> > That method should be pretty quick, so if it’s taking a lot of time
> there may be too many calls to it.
> >
> > My guess is that you’re saving the ‘database’ to disk after every single
> change. That’s going to take O(n^2) time to add n entries, and I can
> believe it would be noticeably slow to add 350. Try doing what I said in my
> last message, using a time delay before saving.
>
>
> I would agree with what Jens says here - the problem isn’t using keyed
> archiving, but the way you’re using keyed archiving.
>
> I sometimes save tens of thousands of objects using keyed archiving and
> it’s not slow. While that’s on Mac not iOS, the difference shouldn’t be
> important. At one time I did run into performance issues with very large
> numbers of objects, but that turned out to be mostly to do with dearchiving
> which called a property setter for each property (some of which had
> side-effects) rather than directly setting the backing store for the
> property. If you’re using automatic backing store synthesis, there’s
> probably not much you can do about that, but you’d want to be definitely
> sure that was the problem before doing anything about it anyway.
>
> Sounds like there is plenty of scope for improving performance in your
> design without changing from keyed archving or needing to look at direct
> propery access. The problem seems to be in your higher-level code that is
> managing the saving to disk of the archives you create.
>
> —Graham
>
>
>
--
Juanjo Conti <jjconti <http://goog_2023646312>@carouselapps.com
<email@hidden>>
Software Engineer - Carousel Apps <https://carouselapps.com>
--
Carousel Apps Limited, registered in England & Wales with registered number
7689440 and registered office Unit 2 Artbrand Studios, 7 Leathermarket
Street, London SE1 3HN. Any communication sent by or on behalf of Carousel
App Ltd or any of its subsidiary, holding or affiliated companies or
entities (together "Watu") is confidential and may be privileged or
otherwise protected. If you receive it in error please inform us and then
delete it from your system. You should not copy it or disclose its contents
to anyone. Messages sent to and from Watu may be monitored to ensure
compliance with our internal policies and to protect our business. Emails
are not secure and cannot be guaranteed to be error free. Anyone who
communicates with us by email is taken to accept these risks.
_______________________________________________
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