Re: Which way is more efficient to get particular EOEnterpriseObject
Re: Which way is more efficient to get particular EOEnterpriseObject
- Subject: Re: Which way is more efficient to get particular EOEnterpriseObject
- From: Guido Neitzer <email@hidden>
- Date: Wed, 15 Aug 2007 21:09:00 -0600
On 15.08.2007, at 17:25, Gennady Kushnir wrote:
- cycle through array (which I get from relationship attribute),
checking
if attributes match
With a hundred objects, that is quite okay. If you have to do it
multiple times, it might be an idea to convert it into a dictionary
and base the keys on the attributes you're looking for - if that is
doable. You haven't given enough information here.
- construct EOQualifier and filter the array with it
Will do a scan of the array.
- just fetch required object regarding mentioned relationship as
just one
of attributes involved
If your array grows to a size that a linear scan or a building a
hashtable (dictionary) is to expensive, a database roundtrip might be
the fastest way if you can use indexes for everything.
- index that array converting it into actual multi-dimensional as
mentioned above (using pure Java multidimensional arrays or nesting
NSArrays/NSDictionaries)
I wouldn't bother with that. Waaaaayyyy to expensive from the
developer time.
And the other thing is: implement it in the easiest possible way, so
you don't waste resources on it and see whether it is actually too
slow. Never optimize anything that doesn't need optimization. Use the
simplest code you can write to get the job done and optimize only, if
that is too slow. Developer time is normally much more expensive than
CPU time.
cug
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden