Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: The speed of blessed hashrefs, the power of Moose - how to get both?

by Your Mother (Archbishop)
on Nov 20, 2011 at 02:55 UTC ( #939027=note: print w/replies, xml ) Need Help??


in reply to The speed of blessed hashrefs, the power of Moose - how to get both?

Testing Perl 5.012002, Moose 1.24, Mouse 0.91, Moo 0.009007, Object::T +iny 1.08, Object::Tiny::XS 1.01 Benchmark: timing 6000000 iterations of Moo, Moo w/quote_sub, Moose, M +ouse, Object::Tiny, Object::Tiny::XS, hash, manual, manual with no ch +ecks... Object::Tiny::XS: 1 secs ( 1.20 usr + -0.01 sys = 1.19 CPU) @ 504201 +6.81/s hash, no check : 3 secs ( 1.86 usr + 0.01 sys = 1.87 CPU) @ 320855 +6.15/s Mouse : 3 secs ( 3.66 usr + 0.00 sys = 3.66 CPU) @ 163934 +4.26/s Object::Tiny : 3 secs ( 3.80 usr + 0.00 sys = 3.80 CPU) @ 157894 +7.37/s hash : 5 secs ( 5.53 usr + 0.01 sys = 5.54 CPU) @ 108303 +2.49/s manual, no check: 9 secs ( 9.11 usr + 0.02 sys = 9.13 CPU) @ 65717 +4.15/s Moo : 17 secs (17.37 usr + 0.03 sys = 17.40 CPU) @ 34482 +7.59/s manual : 17 secs (17.89 usr + 0.02 sys = 17.91 CPU) @ 33500 +8.38/s Mouse no XS : 20 secs (20.50 usr + 0.03 sys = 20.53 CPU) @ 29225 +5.24/s Moose : 21 secs (21.33 usr + 0.03 sys = 21.36 CPU) @ 28089 +8.88/s Moo w/quote_sub : 23 secs (23.07 usr + 0.04 sys = 23.11 CPU) @ 25962 +7.87/s

Mouse(::XS) is probably what you want: Source. Depending on how deep you want to go with Roles and Traits it’s nearly identical code-wise. This is your benchmark with a Mouse addition–

Rate moose mo mouse blessed_hashref + hashref moose 55157/s -- -22% -67% -86% + -88% mo 71023/s 29% -- -58% -82% + -85% mouse 168919/s 206% 138% -- -56% + -65% blessed_hashref 384615/s 597% 442% 128% -- + -20% hashref 478469/s 767% 574% 183% 24% + --

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://939027]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (1)
As of 2023-10-03 01:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?