incubator-esme-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Richard Hirsch <hirsch.d...@gmail.com>
Subject Re: Memory allocation and lazy vals
Date Sat, 28 Nov 2009 15:39:36 GMT
Vassil just did a commit, so it could already be fixed.

I'd try it out. :->

D.

On Sat, Nov 28, 2009 at 4:37 PM, Markus Kohler <markus.kohler@gmail.com> wrote:
> W00T!
> ESME will fly as soon as this is fixed!
> Markus
>
> On Nov 28, 2009 2:36 PM, "Vassil Dichev" <vdichev@apache.org> wrote:
>
> I found a weird thing today. Lazy vals don't act lazy under certain
> conditions.
>
> For those who are not familiar with lazy values, they are values which:
> - are calculated on demand
> - are memoized so that the next invocation won't compute the same code again
>
> You can find a nice article about behavior of lazy vals here:
> http://blogs.tedneward.com/2009/03/29/Laziness+In+Scala.aspx
>
> In ESME's case, lazy values are used to format a message into XML and
> XHTML only once per instance (does that ring any bells?). What happens
> in Message, though, is that digestedXHTML, toXml and originalXml,
> which are all lazy, are executed again and again on each consecutive
> call! I'm not sure why that is, but if I change the access of object
> text to returning a hardcoded value, it works as expected, and gets
> evaluated only once.
>
> I'm currently trying to find the reason for this phenomenon and find
> workarounds. This detail undermines our implementation of caching
> messages, but at least now we know what causes the strange behavior
> observed by Markus.
>

Mime
View raw message