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: Jens Alfke <email@hidden>
- Date: Thu, 06 Aug 2015 09:36:42 -0700
> On Aug 6, 2015, at 6:36 AM, Juanjo Conti <email@hidden> wrote:
>
> I've checked the number of entries and is only 350. They are regular
> cookies for well known sites like google, new relic, twitter...
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.
—Jens
_______________________________________________
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