On Wed, Jul 2, 2014 at 11:53 PM, Sam <perl@net153.net> wrote: > On 06/29/2014 02:44 AM, Manoj Shekhawat wrote: > >> Hi Geeks, >> >> 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. >> >> Thanks in advance!! >> >> -- >> Thanks! >> Manoj Shekhawat >> > > We would need more info on where your people think it is slow at. > Personally, the only performance hits I have noticed is a hit at start up > (everyone knows that), and using native delegation using 'exists' on hashes. > As a test, checking a list of 75k key values against a large hash took > less than a second using a native hash. Using moose with a hashref and a > handle to 'exists' took about 34 seconds. That might be an issue, but the > fix is easy, just don't use a handle and make your own method. And that really boils down to knowing your use case. I almost never use the 'exists' delegate in Native::Attributes because if I am reaching for "exists" I almost always want to treat the data as a hash anyway. Similarly if I have 75K keys in my hash ... I'm pretty sure I will be wanting to treat that data structure specially anyway (and usually as a data structure wholly and not trying to wrap it in methods). As someone who uses Native::Traits a *lot* I can't think of too many places where I would be accessing anything with more than a dozen keys ... so in reality "<1s vs 34s" sounds horrific but in practice how often will you be bitten by that use case? And when you do ... how easy will it be to re-write your data access routines accordingly in those corner cases? -ChrisThread Previous | Thread Next