Skip to main content

Method memoization

3 replies [Last post]
ahabra
Offline
Joined: 2004-01-13
Points: 0

According to wikipedia, memoization is an optimization technique used primarily to speed up computer programs by storing the results of function calls for later reuse, rather than recomputing them at each invocation of the function.

In 2003, javaone had an article by Tom White showing an implementation of memoization. It was a great introduction, but not good enough (imo) for enterprise use.

I have implemented a memoization library and released it with LGPL.
http://www.tek271.com/free/memoizer/tek271.memoizer.intro.html

This implementation uses annotations, is based on cglib, and supports pluggable cache implementations.

Do you guys/gals think it is helpful? Is it worth pursuing? Any suggestions?

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
ahabra
Offline
Joined: 2004-01-13
Points: 0

Correction: The reference to Tom White's article was on onjava not javaone. Sorry. The url to that article is:
http://www.onjava.com/pub/a/onjava/2003/08/20/memoization.html

i30817
Offline
Joined: 2006-05-02
Points: 0

Very interessing article!
Normally i just use maps inside the functions where its a win to store the returned array, but this aproach brings reutilization. Something like this can (and maybe should) be offered in the jdk IMO.

ahabra
Offline
Joined: 2004-01-13
Points: 0

I do agree with you that perhaps something like this should be offered in the JDK. It is very simple and useful. However, my opinion is biased as the creator of this library :).