Very nice. Big savings because of caching the calculation of stringified value (I get an 18% difference, not a 3%). Unfortunally, this technique can't be used if you are subclassing a class that doesn't coorperate - then you will to call
refaddr in each method. That's slower (traditional method being 69% faster), but faster than what I showed before. I would have expected to be able to gain a
little more by writing the methods like:
sub name {
my $key = ${+shift};
$name {$key} = shift if @_;
$name {$key};
}
but that doesn't give me any gain (or loss).
Abigail