Re: possible improvement of Live_Objects cache
[prev]
[thread]
[next]
[Date index for 2005/07/11]
On Mon, 2005-07-11 at 12:08 +0200, Jasper Cramwinckel wrote:
> Hm, does that mean I can not persuade you guys to look in %Live_Objects
> during each retrieve() and skip the query when the object is available? ;-)
That is what it means. If you want a cache, write a subclass for it.
It's very easy in the upcoming release.
> Note that with the current implementation, %Live_Objects van actually
> cost extra queries because a retrieve with essential fields can be
> ignored when in (empty) object is already in %Live_Objects.
Feel free to not keep empty objects lying around in memory...
> > I don't quite see how
> >this fits. I get the gist though -- if the in-memory object only has
> >the primary keys defined, dump the existing data into it. That's
> >probably safe. Doing this in situations where there is more than just
> >the primary key would be questionable.
> >
> >
> Why?
Because of the possibility of overwriting data that is being worked with
in memory. We had discussed various possibilities, like checking for
changed fields or only storing loaded columns that are not in the in-
memory object. Those might end up slowing things down too much to be
worth it. If you'd like to try adding some checks to your patch to
avoid overwriting data and see how much they affect performance, that
would be cool.
- Perrin