[Catalyst] Alternatives to Catalyst ?

Zbigniew Lukasiak zzbbyy at gmail.com
Mon Apr 26 10:22:35 GMT 2010


On Mon, Apr 26, 2010 at 10:57 AM, Ævar Arnfjörð Bjarmason
<avarab at gmail.com> wrote:
> On Mon, Apr 26, 2010 at 09:36, Dermot <paikkos at googlemail.com> wrote:
>> On 21 April 2010 18:01, J. Shirley <jshirley at gmail.com> wrote:
>>> __END__
>>> Benchmark: running all, low, sep for at least 1 CPU seconds...
>>>       all:  1 wallclock secs ( 1.11 usr +  0.00 sys =  1.11 CPU) @
>>> 2917341.44/s (n=3238249)
>>>       low:  0 wallclock secs ( 1.27 usr +  0.04 sys =  1.31 CPU) @
>>> 12930179.39/s (n=16938535)
>>>       sep:  1 wallclock secs ( 1.21 usr +  0.01 sys =  1.22 CPU) @
>>> 3223081.15/s (n=3932159)
>>>
>>> Subroutines suck, lets all use hashrefs.
>>
>> Now that it's quietened down, I can ask a question. Does this I mean
>> it's preferable to use
>>
>> $c->req->{parameters}->{foo}
>>
>> rather than
>>
>> $c->req->param('foo')
>>
>> Obviously I'd rather use the faster method but if I'm breaking the
>> encapsulation in some ways that's going to bite me later, I'd steer
>> clear.
>
> "Obviously".
>
> Unless you're doing method calls in a tight loop somewhere in your
> code you *shouldn't care about this*. Now I've written code that
> actually *did* suffer from method call overhead but since you're just
> casually asking it's very unlikely that you're doing the same.
>
> Don't sprinkle premature optimizations around your codebase just
> because someone produced a benchmark showing one is faster than the
> other. You should be doing *profiling* of your  entire program, not
> micro-optimizing something that's likely 0.0001% of its total runtime.
>

This is a fine advice - but unfortunately the ->param method call
suffers from additional problem - which is described in much detail in
the documentation (go to the NOTE at:
http://search.cpan.org/~bobtfish/Catalyst-Runtime-5.80022/lib/Catalyst/Request.pm#$req-%3Eparam).



-- 
Zbigniew Lukasiak
http://brudnopis.blogspot.com/
http://perlalchemy.blogspot.com/



More information about the Catalyst mailing list