[Catalyst] Alternatives to Catalyst ?
J. Shirley
jshirley at gmail.com
Wed Apr 21 17:01:50 GMT 2010
On Wed, Apr 21, 2010 at 9:30 AM, Oleg Pronin <syber.rus at gmail.com> wrote:
> This was the last shot for me at "dealing" with catalyst.
> Catalyst is very perfomance-optimized system and it never stops me wondering
>
> timethese(-1, {
> sep => sub { $req->param('lang') },
> all => sub { $req->params->{lang} },
> par => sub { $req->parameters->{lang} },
> low => sub { $req->{parameters}{lang} },
> });
>
> Benchmark: running all, low, par, sep for at least 1 CPU seconds...
> all: 1 wallclock secs ( 1.06 usr + 0.00 sys = 1.06 CPU) @
> 74016.94/s (n=78643)
> low: 1 wallclock secs ( 1.09 usr + 0.00 sys = 1.09 CPU) @
> 3816940.66/s (n=4144959)
> par: 2 wallclock secs ( 1.12 usr + 0.00 sys = 1.12 CPU) @
> 75281.78/s (n=84692)
> sep: 1 wallclock secs ( 1.02 usr + 0.00 sys = 1.02 CPU) @
> 24448.98/s (n=25022)
>
>
> 1) Getting all params 3x faster than only one
> 2) Getting $req->{parameters}{lang} 150x faster than $req->param('lang')
>
> Guys, is Catalyst a senior system ?
>
> I think that creator of Moose, and some similar shit is in cooperation
> with hardware manufactorers :-)
> The more CPU spent - the more hardware bought.
>
Maybe you should just go straight to C or assembly?
use Benchmark;
my $foo = { lang => 'en', silly => 'tests', are => 'silly' };
sub foos { return $foo; }
sub foo { return $foo->{$_[0]}; }
timethese(-1, {
sep => sub { foo('lang'); },
all => sub { foos()->{lang}; },
low => sub { $foo->{lang}; }
});
__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.
(PS, your 'all' and 'par' tests are identical, as params is simply an
alias to parameters).
More information about the Catalyst
mailing list