On Jul 5, 2012, at 12:16 PM, Daniel Muey via RT wrote:
Show quoted text> Queue: CHI
> Ticket <URL:
https://rt.cpan.org/Ticket/Display.html?id=78227 >
>
>> CHI gets a ton of benefits from Moose.
>
> And let me assure you, I'm not trying to start a Moose war, I just love the concept of CHI (I enjoyed your talk @
> YAPC about it BTW) and have seen the same basic idea implemented wonderfully without moose (e.g.
> Log::Dispatch)
>
Log::Dispatch was written long, long before Moose. I guarantee that Dave would not consider it wonderful today and that he would use Moose if he created it now. :)
Show quoted text>> What do you mean by "really huge"? Do you mean amount of memory,
>
> yes, process RSS goes up almost 12MB just using it from a quick and dirty check:
>
Ok, that helps quantify it. 12 MB is "big" when compared to raw Perl I suppose, but miniscule when considering amounts of memory on modern systems.
Show quoted text>
>> or number of dependencies,
>
> maybe a bit: it takes time to find all of them and load them and compile them
about 1 minute on my system
Show quoted text> for what benefit exactly? a few less
> lines of code and MOPiness? Doesn't seem worth it to me for an abstract caching mechanism
It is very much worth it, assuming that you don't consider 12 MB a significant cost on any modern system, which I don't. An incomplete list of benefits off the top of my head:
* Default attribute values and lazily built attributes
* Type checked attributes and type coercion
* Strict constructor (dies if bad key is passed - not in CHI currently but will be shortly)
* Optimized constructors
* Roles, for things like size awareness and subcaches
* Method modifiers, e.g. before, after, around
You can see evidence of the first three in the first 50 lines of CHI/Driver.pm. For the last two see
http://www.openswartz.com/2009/06/01/how-roles-pushed-me-over-to-the-moose-side/
Yes, it is possible to do all this without Moose, of course. Just a ton more code, tedium, testing, reinventing the wheel. I am living this now with Code::TidyAll (
https://metacpan.org/module/tidyall), which I wrote without Moose because the common case is using a command-line script and I am sensitive to Moose's startup cost for this particular case. I am really missing Moose in the development of even this much smaller distribution, and if/when Moose startup time improves as it almost certainly will in the future (they are planning to embed the MOP into Perl), I will move this to Moose right away.
Show quoted text>> Are you on a hosting provider with a very restricted
>> amount of memory/disk space?
>
> no, I just don't want my personal servers bogged down for no reason and our customers demand reasonable
> memory use, thus Moose is out the door along w/ Java :)
I'm shocked that 12 MB per process makes a difference, especially if you are using a web or other pre-forked app in which most of this would be shared memory. Does it really matter to your customers? Or is it mostly psychological/principle?
Of course, you are free to write CHI::NoMoose or whatever. Just keep in mind the time/money trade-off and ask yourself how much it would cost to add a GB or whatever to your server instead.
HTH,
Jon