Re: Knowing when a NSArrayController is ready
Re: Knowing when a NSArrayController is ready
- Subject: Re: Knowing when a NSArrayController is ready
- From: "email@hidden" <email@hidden>
- Date: Sun, 25 Jan 2009 16:08:56 +0000
On 24 Jan 2009, at 18:41, Matt Neuburg wrote:
On or about 1/24/09 10:17 AM, thus spake "email@hidden"
<email@hidden>:
I am also having horrible performance problems.
A data set of 1500 items with a total on disk size of 1.8MB is taking
more than 30 secs to load.
Maybe NSArrayController -fetchWithRequest will improve things.
I would ask you the same question I just asked someone else on the
list: are
you using the XML persistent storage format? Because, if so, you
must expect
some delay, since even before you fetch any objects the entire XML
file must
be loaded into memory and parsed.
I use XML because I want human readability for my data, so startup
speed is
a sacrifice I am prepared to make. My data consists of about 5000
items, but
they are very simple; dealing with complex objects would take
considerably
longer, one assumes. In order to cave-man-instrument the startup
procedure
via NSLog, I do NOT prepare content or even bind my array controller's
managed object content in the nib; instead, I do it all manually in
awakeFromNib. Here are some NSLog timings:
2009-01-24 10:37:09.157 [788] awakening from nib
2009-01-24 10:37:09.269 [788] binding to MOC
2009-01-24 10:37:09.359 [788] creating whole shebang
2009-01-24 10:37:09.360 [788] adding persistent store
2009-01-24 10:37:13.877 [788] calling fetch
2009-01-24 10:37:14.192 [788] done calling fetch
Notice the big delay between "adding persistent store" and "calling
fetch";
that consists a single line of code (calling
addPersistentStoreWithType:).
So the delay there is nothing but the XML file being loaded and
parsed. m.
Hi Matt
I decided to follow your example so I set prepareContent = NO and
called -fetchWithRequest:merge:error: from my controller.
I also switched between the XML and SQLite store types to see the
effect.
I also made use of -setUsesLazyFetching.
Timings are Cro-magnon.
The results for a default fetch on a data set of 1500 very simple
objects are:
XML - usesLazyFetching = NO 38.00 sec load
XML - usesLazyFetching = YES 4.78 sec load
SQLite - usesLazyFetching = NO 35.25 sec load
SQLite - usesLazyFetching = NO 2.07 sec load
So I started with a fetch time of 38s and reduced it to 2 secs without
making any changes to my model code.
I also checked the -arrangedObjects observation on the
NSArrayController in this configuration.
I only get one notification generated before the fetch returns.
There is a subsequent notification but that results from sorting the
content.
Jonathan Mitchell
Central Conscious Unit
http://www.mugginsoft.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