develooper Front page | perl.perl5.porters | Postings from July 2010

Re: Directions of perl 5 development - requests from companies

Thread Previous | Thread Next
From:
H.Merijn Brand
Date:
July 10, 2010 14:10
Subject:
Re: Directions of perl 5 development - requests from companies
Message ID:
20100710231031.6aa30010@pc09.procura.nl
On Fri, 9 Jul 2010 23:41:34 +0100, Tim Bunce <Tim.Bunce@pobox.com>
wrote:

> On Fri, Jul 09, 2010 at 10:30:48AM +0200, Reini Urban wrote:
> > 2010/7/9 H.Merijn Brand <h.m.brand@xs4all.nl>:
> > > On Thu, 8 Jul 2010 23:03:43 +0100, Tim Bunce <Tim.Bunce@pobox.com>
> > >> I think many people consider the cost of sub/method calls a significant
> > >> issue. Here's a little bit of code that exercises sub calls with args,
> > >> recursion, object creation/destruction, and hash creation. It runs on
> > >> all perl versions and can easily be tuned to suit the cpu performance:
> > >>
> > >> $ time perl -e 'sub f { my($n)=@_; my $h=bless { 1..10 }; return $n if $n < 2; f($n-1)+f($n-2) } f(25)'
> > 
> > The ackerman with 25 recursions is probably to small. I used 28 to get
> > longer runtimes > 5 sec < 30 sec.
> 
> Yes, I should have made that more clear.
> 
> > Some array access, simple IO and string (regex + realloc) should
> > probably be added.
> > A Schwartzian Transform maybe.
> > And use of a big core module. I use Module::Build in my tests because
> > this is the biggest op-wise and the worst.
> 
> I wouldn't add IO (adds noise) or use a module (unless you can arrange
> to have exactly the same code and same dependencies installed for all perls).
> Your point about regex + realloc is good.
> 
> We could spend forever debating the balance of various options.
> There's no right answer. All I'm after here is something reasonable in
> one line that'll run in a comparable way on all perl versions.
> 
> Here's an updated version that I've tweaked to include regex + realloc
> and have a reasonable balance of opcodes times:
> 
> perl -e 'sub f{my($n)=@_; $n==8 and bless{1..4} and $a=~s/$/../; $n<2 and return $n;f($n-1)+f($n-2)} f(30)'
> 
> 13% entersub, 10% subtract, 10% leavesub, 10% return, 7% padsv,
> 5% aasign, 5% add, 5% subst, 3% nextstate.

note that /usr/bin/perl is the only threaded build. All are -DDEBUGGING
/usr/bin/perl - v5.10.0 built for i586-linux-thread-multi
/pro/bin/perl - v5.12.0 built for i686-linux-64int-ld
all others    -         built for i686-linux-64int

perl-xxx -e 'sub f{my($n)=@_;$n==8 and bless{1..4}and$a=~s/$/../;$n<2 and return$n;f($n-1)+f($n-2)}f(33)'
rank elapsed    pass perl              perl               rank
==== ========== ==== ================= ================== ====
   1   17.87718 PASS base/perl5.00503  /usr/bin/perl        27
   2   18.14303 PASS base/perl5.6.1    /pro/bin/perl        24
   3   19.37749 PASS base/perl5.8.7    base/perl5.00307     32
   4   19.44928 PASS base/perl5.8.0    base/perl5.00405     31
   5   19.94081 PASS base/perl5.6.0    base/perl5.00503      1
   6   20.04889 PASS base/perl5.13.1   base/perl5.00504     15
   7   20.05088 PASS base/perl5.8.2    base/perl5.6.0        5
   8   20.06635 PASS base/perl5.13.2   base/perl5.6.1        2
   9   20.41931 PASS base/perl5.8.6    base/perl5.6.2       11
  10   20.56071 PASS base/perl5.12.0   base/perl5.8.0        4
  11   20.60507 PASS base/perl5.6.2    base/perl5.8.1       25
  12   20.67481 PASS base/perl5.11.4   base/perl5.8.2        7
  13   20.69468 PASS base/perl5.8.5    base/perl5.8.3       14
  14   20.78105 PASS base/perl5.8.3    base/perl5.8.4       23
  15   20.83540 PASS base/perl5.00504  base/perl5.8.5       13
  16   20.89590 PASS base/perl5.8.8    base/perl5.8.6        9
  17   20.89896 PASS base/perl5.11.2   base/perl5.8.7        3
  18   21.00515 PASS base/perl5.12.1   base/perl5.8.8       16
  19   21.21893 PASS base/perl5.11.0   base/perl5.8.9       21
  20   21.24675 PASS base/perl5.10.1   base/perl5.10.0      30
  21   21.53738 PASS base/perl5.8.9    base/perl5.10.1      20
  22   21.54386 PASS base/perl5.11.3   base/perl5.11.0      19
  23   21.90396 PASS base/perl5.8.4    base/perl5.11.1      28
  24   21.92762 PASS /pro/bin/perl     base/perl5.11.2      17
  25   22.01438 PASS base/perl5.8.1    base/perl5.11.3      22
  26   22.31189 PASS base/perl5.13.0   base/perl5.11.4      12
  27   22.35381 PASS /usr/bin/perl     base/perl5.11.5      29
  28   22.67522 PASS base/perl5.11.1   base/perl5.12.0      10
  29   23.84738 PASS base/perl5.11.5   base/perl5.12.1      18
  30   24.42172 PASS base/perl5.10.0   base/perl5.13.0      26
  31  390.94774 PASS base/perl5.00405  base/perl5.13.1       6
  32  405.62753 PASS base/perl5.00307  base/perl5.13.2       8

So, what is the noise level now?

> (The $n==8 can be tuned to make the "and ...;" code run more of less often.)
> 
> On Fri, Jul 09, 2010 at 01:04:39PM +0200, H.Merijn Brand wrote:
> > 
> > rank elapsed    pass perl              perl               rank
> > ==== ========== ==== ================= ================== ====
> >    1    2.38609 PASS base/perl5.00504  /usr/bin/perl        29
> 
> Could you indulge me once more by running the above raising the number
> so each tests runs in 20 or more seconds? Thanks!

-- 
H.Merijn Brand  http://tux.nl      Perl Monger  http://amsterdam.pm.org/
using 5.00307 through 5.12 and porting perl5.13.x on HP-UX 10.20, 11.00,
11.11, 11.23, and 11.31, OpenSuSE 10.3, 11.0, and 11.1, AIX 5.2 and 5.3.
http://mirrors.develooper.com/hpux/           http://www.test-smoke.org/
http://qa.perl.org      http://www.goldmark.org/jeff/stupid-disclaimers/

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About