in reply to Good metrics for Memoization
Take for example a function today_plus_x in a long running script... all of today today_plus_x(1) returns 2007/08/09... but after midnight it will return 2007/08/10... assume someone is calling this 1000 times a day... obviously it could use some help, but blanket memoization isn't going to do it.
Probably your best be would be something like Devel::DProf, something which analyzes your running code and wraps all function calls... at the end you print out a list of the calls that had multiple calls that returned the same data for the same inputs, maybe combined with how long a typical call takes, then you can suggest memoizations, but it'll have to be up to the programmer to decide if it is appropriate on a case by case basis.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Good metrics for Memoization
by Trizor (Pilgrim) on Aug 08, 2007 at 22:35 UTC | |
by chromatic (Archbishop) on Aug 09, 2007 at 06:03 UTC | |
by suaveant (Parson) on Aug 09, 2007 at 03:13 UTC |