[elephant-devel] Persistent class slot

Warren Lynn wrn.lynn at gmail.com
Sun May 30 00:38:58 UTC 2010


As I understand from the online document, class slots with :allocation
:class are not persisted. Is there any plan to change that soon?

I first did not think that is such a big deal, but then I encountered a
performance issue to which I think persisted class slot may be the answer.

The issue I have is: I am using Weblocks + Elephant + Postmodern to display
the instances of a class in paginated web pages. Weblocks needs to know the
total count of the instances to plan the pagination (so it can display
something like "1 of xxx pages" ). It turns out just counting (by map-class)
the instances (about 5000) will take about 8 seconds (my laptop is not that
powerful, but quite decent).

So I think a possible solution is to allow a class to have persisted class
slots, like "count". Then, some generic functions can be defined to allow
the user code to update the persisted class slots in a contention safe way
(wrapped in transactions) on some critical check-points,  such as when a new
instance is persisted or when a instance is deleted/modified. The functions
could be named as "on-delete, on-add, on-modified. This way we can keep an
up-to-date count all the time. Actually, class slot like "count" may even be
made ready for the user to use directly without any addition user code.

Counting instances of a class seems to be a very common use case. So I hope
the above is convincing enough for the need of persistent class slots. But I
am too inexperienced to know how much work this will require.

Thanks for any comments.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/elephant-devel/attachments/20100529/601df220/attachment.html>

More information about the elephant-devel mailing list