use v5.14; use Benchmark qw(cmpthese); package Foo1 { sub new { bless $_[1], $_[0] } sub foo { $_[0]{foo} } } package Foo2 { use Moo; has foo => (is => 'ro'); } package Foo3 { use Moose; has foo => (is => 'ro'); } # Note that I'm not even doing the make_immutable # secret sauce with Moose because that only affects # the speed of the constructor and destructor, not # accessors. my $foo1 = Foo1::->new({foo => 0}); my $foo2 = Foo2::->new({foo => 0}); my $foo3 = Foo3::->new({foo => 0}); cmpthese(1_000_000, { plain_perl => sub { $foo1->foo }, moo => sub { $foo2->foo }, moose => sub { $foo3->foo }, });