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: "Gennady Kushnir" <email@hidden>
- Date: Thu, 16 Aug 2007 08:12:08 +0400 (MSD)
- Importance: Normal
> 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.
In fact, building a dictionary - it is what I ment by "indexing". Maybe
that's not correct to call it so.
> > - 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.
Only for that HUUGE arrays? I thowght, that caching of objects, that EOF
do shoud significally speed up fetches... Will it do real database
roundtrip for fetching an object that's already cached in memory? (I know
it is, as it is in that array in relationship attribute)
> 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.
Thank you for that advice, I'll take it into accont ))
In fact when I'm trying to "opimise" I optimise both CPU and developer
time. In this particut=lar case - it would be much easier to utilise a
structured hashtable than to write a cycle or qualifier each time I mant
to get something from that unstructured array.
Thank you all who replied.
I think I'll buld a hashtable on demand (when this kind of query is first
required).
Gennady
_______________________________________________
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