http://www.perlmonks.org?node_id=1080396


in reply to Re^2: Perl object memory overhead
in thread Perl object memory overhead

Ooh! Do I spy a benchmark special case like the ones that compiler makers used to add to get good scores? :)

isa => 'Int', traits => ['Counter'], handles => { adjust_a => 'inc' },

What if you changed the increment to +33?

Also, it would be really useful to see the timing of adjust_a() run on the 3e6 objects, along with memory consumption?


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

Replies are listed 'Best First'.
Re^4: Perl object memory overhead (Benchmark special case?)
by tobyink (Canon) on Mar 31, 2014 at 16:54 UTC

    There's this:

    handles => { adjust_a => [ 'inc', 33 ] },

    It's not as fast because the arrayref in handles results in a curried coderef, but not unacceptably slow either.

    use Moops; class Cow :rw { has name => (default => 'Ermintrude') }; say Cow->new->name