Re: Knowing when a NSArrayController is ready
Re: Knowing when a NSArrayController is ready
- Subject: Re: Knowing when a NSArrayController is ready
- From: Ben Trumbull <email@hidden>
- Date: Sun, 25 Jan 2009 14:41:17 -0800
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.
Matt,
Have you considered an alternative solution where you use an SQLite
store as a cache ? You can import and export to the XML store, either
by user action or automatically (like at quit time). On launch you
can even check if the timestamp on the XML file is changed, and
reimport it if you need interoperability with other tools.
Many projects on many platforms use SQLite as an efficient cache for
runtime operations, but not necessarily the canonical data format.
This would greatly improve your launch times, save times, memory
utilization, and overall scalability.
- Ben
p.s. XML is human readable ? Like punch cards ? You can pipe the
output of /usr/bin/sqlite3 anywhere you want. To each their own ...
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.
_______________________________________________
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