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: Pierre Bernard <email@hidden>
- Date: Thu, 16 Aug 2007 19:18:42 +0200
Hi!
I have a to-many relationship, which points to rather large (about
100)
heap of objects.
100 is by no account a large number.
- cycle through array (which I get from relationship attribute),
checking
if attributes match
Kinda OK.
- construct EOQualifier and filter the array with it
Much better. It doesn't do anything magic: it cycles through the
array. Your code will however be shorter and more readable. Thus less
error prone.
- just fetch required object regarding mentioned relationship as
just one
of attributes involved
A to-many is always the inverse of a to-one. You could qualify
objects using that to-one. I have done this on relationships having
300000-500000 objects. For 100 it is overkill in both code to write
and IO accesses.
- index that array converting it into actual multi-dimensional as
mentioned above (using pure Java multidimensional arrays or nesting
NSArrays/NSDictionaries)
I would recommend this if you need to get multiple objects from the
same relationship or if you repeatedly need to get to the object.
There is no point in scanning the array over and again.
You can listen to EOF notifications to see when your cache goes stale.
Pierre
Sorting wil not do as the order in which objects will be needed is
uneasy
to predict
Also this is not immutable and other objects into the array may
appear -
so I want to have them on their place immediately.
Regards,
Gennady
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
email@hidden
This email sent to email@hidden
- - -
Houdah Software s. à r. l.
http://www.houdah.com
HoudahGeo: One-stop photo geocoding
HoudahSpot: Powerful Spotlight frontend
_______________________________________________
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