On 12/10/2002 5:46 PM, Smylers wrote:
OK. There was something on MJD's QOTW recently where using the current
Perl 5 Memoize module slowed code down -- that gave me the impression
that caching had the potential.
It does. In fact, all caching has that potential. Specificly, if the
time to look
On Tue, Dec 10, 2002 at 01:53:28PM +1100, Damian Conway wrote:
And in those rare cases where you really do need partial caching, the
simplest solution is to split the partially cached subroutine into a
fully cached sub and an uncached sub:
sub days_in_month(Str $month, Int $year)
{
On Mon, Dec 09, 2002 at 01:58:11PM -0800, Austin Hastings wrote:
--- Adam Turoff [EMAIL PROTECTED] wrote:
It doesn't matter whether some of the values are cheap lookups
while other values are complex calculations. Once a cached sub
is called with a set of parameter values, the return value
On Mon, Dec 09, 2002 at 01:58:11PM -0800, Austin Hastings wrote:
--- Adam Turoff [EMAIL PROTECTED] wrote:
I think you're trying to overoptimize something here. I can't see
a benefit to caching only sometimes. If there is, then you probably
want to implement a more sophisticated cache
On Mon, Dec 09, 2002 at 02:20:01PM -0800, Austin Hastings wrote:
--- Paul Johnson [EMAIL PROTECTED] wrote:
How about the same way as one would do it now? Presumably we won't
all
forget how to program when Perl 6 comes out.
I think you've missed the point. The original poster (Smylers)
Michael G Schwern wrote:
On Mon, Dec 09, 2002 at 08:36:20PM -, Smylers wrote:
That way a function could decide to cache some return values but not
all of them.
The example above is a classic example of premature optimization.
There's nothing which ways the cache would be
On Tue, Dec 10, 2002 at 10:46:07PM -, Smylers wrote:
The example above is a classic example of premature optimization.
There's nothing which ways the cache would be counter-productive for
simple calculations since the caching logic is nearly as simple.
OK. There was something on
Adam Turoff wrote:
sub days_in_month(Str $month, Int $year)
{
$month = lc $month;
if $month eq 'feb'
{
my sub feb_days (Int $year) is cached {
my $leap = $year % 4 == 0
($year % 100 != 0 || $year % 400 == 0);
return $leap ? 29 : 28;
}
return
On Mon, Dec 09, 2002 at 08:36:20PM -, Smylers wrote:
I was wondering whether it'd be better to have this specified per
Creturn rather than per Csub. That'd permit something a long the
lines of:
sub days_in_month(Str $month, Int $year)
{
}
Perhaps there are only some
--- Adam Turoff [EMAIL PROTECTED] wrote:
On Mon, Dec 09, 2002 at 08:36:20PM -, Smylers wrote:
Perhaps there are only some edge cases which require calculation;
or the function is liable to be called with many invalid input
values, which can quickly be determined yield Cundef and so
On Mon, Dec 09, 2002 at 01:58:11PM -0800, Austin Hastings wrote:
--- Adam Turoff [EMAIL PROTECTED] wrote:
On Mon, Dec 09, 2002 at 08:36:20PM -, Smylers wrote:
Anybody else like this, or are we better off leaving things as they
were?
I think you're trying to overoptimize
--- Paul Johnson [EMAIL PROTECTED] wrote:
On Mon, Dec 09, 2002 at 01:58:11PM -0800, Austin Hastings wrote:
Ahh. This is better. How does one implement a more sophisticated
cache management strategy?
That is, what is the mechanism for manipulating the run-time system
behavior of subs?
On Mon, Dec 09, 2002 at 02:20:01PM -0800, Austin Hastings wrote:
--- Paul Johnson [EMAIL PROTECTED] wrote:
On Mon, Dec 09, 2002 at 01:58:11PM -0800, Austin Hastings wrote:
Ahh. This is better. How does one implement a more sophisticated
cache management strategy?
That is, what is
On Mon, Dec 09, 2002 at 08:36:20PM -, Smylers wrote:
Last month's discussion on memoization[*0] had the consensus that
Ccached is the appropriate property name, used like so:
sub square (Num $n) is cached { ... }
I was wondering whether it'd be better to have this specified per
Smylers wrote:
I was wondering whether it'd be better to have this specified per
Creturn rather than per Csub.
I doubt it. There's no performance gain from partial caching since
you have to check the cache anyway to detect that a particular result
isn't cached.
And in those rare cases where
15 matches
Mail list logo