Women in Technology

Hear us Roar



Article:
  Memoization in Java Using Dynamic Proxy Classes
Subject:   Caching decision at run time
Date:   2003-08-21 04:40:33
From:   anonymous2
If your Memoizer.memoize method returned a transitional object (basically a morphing singleton) you could use the statistics at runtime to make that decision.


The transitional object would collect statistics and also serve "getMemo()" the memo object to the client (what you currently return from Memoizer.memoize).


Once enough runs of the calculation have been done, this method could decide to return the real object or continue returning the memo version, minus statistics collection.


This would only make sense for long running processes that use the memo object more than once. But it would also safeguard against making performance decisions for one platform, and finding out it is wrong for another.


Yuri.

Main Topics Oldest First

Showing messages 1 through 1 of 1.

  • Tom White photo Caching decision at run time
    2003-08-22 00:17:43  Tom White | O'Reilly Author [View]

    This is a nice idea. Getting the framework to make a performance descision at runtime would be very neat (analogous to the HotSpot compiler deciding which code to optimise). Do you have an idea of what the usage pattern would be? I.e. would there be an extra method call that the client would have to make?

    Tom