As the first option just benchmark it. If something costly is actually costly, you can run it a few times and check if the run time is that of a few hash look ups or of doing something costly a few times. Particularly compare the time for the first call to subsequent calls.
The second idea is to use PadWalker to peek into the sub's lexical pad.
That being said caching is a mechanism that can easily be factored out (Memoize) and tested separately, so usually you don't need that sort of test at all.
In reply to Re: How to test caching?
by moritz
in thread How to test caching?
by JavaFan
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |