[sf-perl] Real perl
Dodger
el.dodgero at gmail.com
Wed Apr 11 03:35:05 PDT 2012
package False::Laziness;
...
Sent from my iPhone
On 10/04/2012, at 3:29 PM, Dana Diederich <diederich at gmail.com> wrote:
> That's a bit of an absolute statement, Randal. There are definitely highly relevant cases where it doesn't make sense to use Moose and friends. If program load time or overall performance is a primary goal, 'old school' Perl might make more sense. Granted it's often possible to re-frame the overall problem so those aspects aren't as important, but it often doesn't make sense to do that.
>
> dana at hithlum:~/bench$ cat p1
> #!/usr/bin/perl
>
> my $foo = {};
> bless $foo, 'Foo';
>
> my $counter = 1;
> for(1..100000) {
> $counter = $foo->adder($counter);
> }
> print "$counter\n";
>
> package Foo;
>
> sub
> adder {
> return $_ + 1;
> }
>
> dana at hithlum:~/bench$ time ./p1
> 100001
>
> real 0m0.045s
> user 0m0.044s
> sys 0m0.000s
> dana at hithlum:~/bench$ cat p2
> #!/usr/bin/perl
>
> use lib '.';
> use Foo;
>
> my $foo = Foo->new;
> my $counter = 1;
> for(1..100000) {
> $counter = $foo->adder($counter);
> }
> print "$counter\n";
> dana at hithlum:~/bench$ cat Foo.pm
> use MooseX::Declare;
>
> class Foo {
> method adder (Num $ct) {
> return $ct + 1;
> }
> }
> dana at hithlum:~/bench$ time perl ./p2
> 100001
>
> real 0m13.718s
> user 0m13.661s
> sys 0m0.044s
> dana at hithlum:~/bench$
>
> I write code using Moose and the wide galaxy of exceptional modules it has spawned every day. And I yearn for the day that I can use Perl6 in my production environment. (It's getting close, last time I looked!) But sometimes raw 'cpu' performance is important.
>
> Most of the time, I start using the highest-level modules possible, and if there's a performance problem, I end up 'dumbing down' the hot-spots, using simpler Perl. For me, this is rare.
>
> Cheers,
> -Dana
>
> On Tue, Apr 10, 2012 at 2:00 PM, Randal L. Schwartz <merlyn at stonehenge.com> wrote:
> >>>>> "Dodger" == Dodger <el.dodgero at gmail.com> writes:
>
> Dodger> So... How about some old school perl without mooses and meeses?
> Dodger> Anybody out there code in... You know... Perl?
>
> Seriously, if you're launching green code and not using Moose, you have
> some weird nostalgia in you that prevents you from being a useful coder
> for me or my clients.
>
> --
> Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
> <merlyn at stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
> Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
> See http://methodsandmessages.posterous.com/ for Smalltalk discussion
> _______________________________________________
> SanFrancisco-pm mailing list
> SanFrancisco-pm at pm.org
> http://mail.pm.org/mailman/listinfo/sanfrancisco-pm
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/sanfrancisco-pm/attachments/20120411/c1a05b34/attachment.html>
More information about the SanFrancisco-pm
mailing list