in reply to how to improve the performance of a perl program

Re point #1, the idea is to avoid, say:

if ($thing->position->x == 0 and $thing->position->y == 0) { ...; }

... which calls $thing->position twice, with something like this:

my $pos = $thing->position; if ($pos->x == 0 and $pos->y == 0) { ...; }

... which only calls it once.

package Cow { use Moo; has name => (is => 'lazy', default => sub { 'Mooington' }) } say Cow->new->name