On Tue, Jan 28, 2003 at 09:11:49AM -0500, John Peacock wrote:
> Dave Rolsky wrote:
> >
> >So you want to greatly complicate the internals (and slow it down, I'd
> >bet), for what?
> >
>
> Tell you what; I'll write an implementation of my way (probably in XS) and
> we'll compare. I think you're mistaken; your storage methods requires
> conversion for all nontrivial operations (e.g. $dt->year),
The code path for year (and month etc etc) may end up looking like this:
sub year {
my $year = $_[0]->{__year}; # or $_[0]->{cache}{year}
return $year if defined $year;
...
}
which would naturally be much faster than the current code.
(In my earlier message I wasn't clear that I was refering to external
memoize methods, like the Memoize module, probably having too much
overhead for this application, rather than memoize concept in principle.)
> The only issue I need to deal with is
> determining which sub's compromise the actual implementation and which are
> producing values derivable from those subs. Going forward, it would be a
> very good idea to restructure the code so that this is obvious. I would
> even suggest going ahead and pulling all of the internals code out of the
> base module and create a default implementation module.
Probably a good idea.
Tim.