What you are talking about is nearly impossible, since just because a function returns the same data for the same parameters 99 times, it doesn't mean it will on the hundredth...
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.
- Ant
- Some of my
best work - (1 2 3)
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.