It'd be nice to load readonly objects

Bug #814503 reported by Jamu Kakar
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Storm
New
Wishlist
Unassigned

Bug Description

It'd be nice if it were possible to load readonly objects,
particularly if it meant they were loaded faster.

Revision history for this message
Thomas Herve (therve) wrote :

It'd be even better to have a better description of what you have in mind :). Bonus point if you have an API idea.

Changed in storm:
importance: Undecided → Wishlist
Revision history for this message
Jamu Kakar (jkakar) wrote :

I want to load objects that are:

- Not hooked up to the event system, so that they're faster to load.

- Will not have any changed persisted to the database on a
  store.commit().

- Are (maybe?) not cached.

The goal is primarily to get some speedup and secondarily some safety,
knowing that an accidentally modified object won't persist on a
commit. As far as an API, I've been thinking about this:

    result = store.find(...)
    result.config(readonly=True)

And maybe also some control about caching:

    result.config(cache=False)

I cooked up some code to monkey patch a ResultSet and override the
default object building behaviour, but it probably isn't directly
usable, since I have a feeling it breaks References and ReferenceSets
(maybe this is okay)? I also haven't profiled this, so I have no idea
if it actually yields much benefit in terms of performance. I do
wonder if this kind of thing could help make it easier to load objects
out of memcache or similar.

Revision history for this message
Jamu Kakar (jkakar) wrote :
Revision history for this message
Jamu Kakar (jkakar) wrote :

The attached patch is used like this:

    result = store.find(...)
    for readonly_object in readonly(result):
        ...

Revision history for this message
Gustavo Niemeyer (niemeyer) wrote :

Hey Jamu,

Do you have any benchmarks regarding actual effects of the change?

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Bug attachments

Remote bug watches

Bug watches keep track of this bug in other bug trackers.