On Sun, 29 Jun 2014, Manoj Shekhawat wrote:
Can you please give me proper justification that Moose isn't that slow,
many people in my organisation are resisting its usage by just saying
that it's slow.
I know we can increase it's speed by using:
__PACKAGE__->meta->make_immutable;
But any other points will be very helpful, we in our organization are deciding
to build a new automation tool using Moose.
It really depends on what you're measuring and what you're measuring
against.
Moose is very clearly quite slow when it comes to measuring program
startup. Making classes immutable only makes that problem _worse_ because
now Moose has to do even more stuff than before!
At runtime, Moose is about as fast as optimized code to do whatever you
told Moose to do. In other words, a naive implementation of constructors,
accessors, type checking, etc. would probably be slower than Moose's
implementation.
If you used things like Class::XSAccessor, however, you'd end up with
faster code than Moose (but without any possibility of applying many Moose
features).
And of course, Moose gives you all these wonderful features near at hand,
so you use them. Type checking is a good example. I suspect most people
never really bother with it in non-Moose code, but since Moose makes this
so damn convenient, now you're checking types everywhere and things are
slower.
That all said, you haven't actually said what your coworkers are saying,
so it's hard to refute an argument when I'm just guessing at the argument
I need to refute.
Cheers,
-dave
/*============================================================
http://VegGuide.org http://blog.urth.org
Your guide to all that's veg House Absolute(ly Pointless)
============================================================*/