[erlang-questions] Random newbie stuff

Dennis Byrne dbyrne@REDACTED
Sun Nov 4 15:13:39 CET 2007


Yeah, memorization is a good way to put it.  The closest thing I've seen 
to this was from a friend of mine who was using aspects to implement 
method level caching in java. This of course is not supported by the 
language itself.
____________________________________________
Dennis Byrne
ThoughtWorks - Chicago
312-505-7965



"Brandon Black" <blblack@REDACTED> wrote on 11/04/2007 07:52:02 AM:

> 

> On 11/4/07, Dennis Byrne <dbyrne@REDACTED> wrote:
> 
> Hello Ulf, 
> 
> If you have a function that is 100% predictable, couldn't there be 
> some serious performance gains given that the function is frequently 
> passed the same message?  In other words, why put a core to work 
> calculating the result you gave last time someone sent you a given 
> message?  It would be better to use this function to spawn a process 
> that could use the process dictionary as a cache (one that would 
neverexpire). 
> 
> 
> What you're basically asking for there is memoization.  It would be 
> interesting to have memoization supported at the language level.  The 
> compiler/interpreter isn't smart enough to know when memoization makes
> the most sense (depends on freq/range of inputs, computational 
> complexity of function), but the programmer probably knows.  You would
> need a syntax for specifying function "attributes" to the 
> compiler/interpreter.  Borrowing the ":attrib" syntax from Perl, it 
> would look like: 
> 
> somecomplexfunc(X) :memoize -> ... complex body ...
> 
> I'm guessing that analysis tools could easily throw an error at you if
> you've put :memoize on a function which (directly or indirectly by 
> calling other funcs) makes use of mutable state. 
> 
> -- Brandon
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20071104/33e99684/attachment.htm>


More information about the erlang-questions mailing list