Thanks for the Chromatic blog link - that cleared up a lot.
Sounds like not much room for optimizing the gcc compile.

As for the code, the first one was:
time perl6 -e 'say ("a".."z").pick ~ ("a".."z").pick for ^1000;' > /dev/null

For my 32-bit linux box, bash's time reports

Rakudo Star 2010.07
real    1m44.549s
user    1m43.386s
sys    0m0.664s

Rakudo Atlanta 2010.07 (parrot 2.6.0 r48152)
real    2m50.081s
user    2m47.522s
sys    0m0.848s

Rakudo Moscow 2010.04 (parrot 2.3.0-devel r45822)
real    1m19.890s
user    1m19.057s
sys    0m0.796s

I've also noticed that 64 bit linux binaries for rakudo builds are ~2x the size of the 32 bit builds, FWIW.

the other piece of code, which was ported from perl5 and probably could be written way better is:

#!/home/ben/Dev/rakudo/current/perl6
# -*- cperl -*-
#use v6;

my $fullline=Bool::False; ## need to add back getopt for fullline, default to zero.

die("need two files as arg.\n") unless (@*ARGS.elems == 2);
my $fname1 = @*ARGS[0];
my $fname2 = @*ARGS[1];

my %hash1 = fileToHash($fname1,:fullline($fullline));
my %hash2 = fileToHash($fname2,:fullline($fullline));
my %hash3;
%hash3{%hash1.keys(), %hash2.keys()}=1;

for %hash3.keys.sort -> $item {

  if (%hash1.exists($item) and %hash2.exists($item)) {
        print "F1ANDF2 $item\n";
  } elsif %hash1.exists($item) {
        print "F1NOTF2 $item\n";
  } elsif %hash2.exists($item) {
        print "F2NOTF1 $item\n";
  } else {
        die "wtf.. cant find '$item' in either list\n";
  }
}

sub fileToHash ($fname, Bool :$fullline = 0 ) returns Hash {
  my %ahash=();
  my $fh = open $fname or die "failed to open $fname for read\n";
  for $fh.lines {
        if $fullline {
          %ahash{ $_ }=1;
} else { ## default - do only the first word.
          %ahash{ $_.split("/s+")[0] }=1;
        }
  }
  $fh.close;
  return(%ahash);
}



On 08/01/2010 06:23 AM, Jan Ingvoldstad wrote:
On Fri, Jul 30, 2010 at 23:31, Ben Bowers<[email protected]>  wrote:

I've compiled and run rakudo star on a couple of pieces of code that i
wrote.
One generates random strings with pick.  the other builds a couple of
hashes and checks to find commonality between them.
Compared with Rakudo Moscow (April release), both pieces of code run
about 50% slower with Rakudo Star.

Could you post the code in question, so that the Smart Guys (that does not
include me, I'm afraid) can have a poke at it?


For reference, similar functioning code in perl5.8 is at least an
order of magnitude (or more) faster than either of my perl6 testcases.

I also noticed that my binary size is much smaller for perl5 than
perl6: (linux x86_64)
perl5.8.8 : 1.5MB
rakudo moscow : 20MB
rakudo star : 27MB

The point this is that i'm not sure if i'm compling it properly.
Possibly the amount of debug is set to the max level?
Is there anything i can do to optimize the compile for increased
performance?

Chromatic tried to say something about optimization in his response to a
performance comparison:

http://www.modernperlbooks.com/mt/2010/07/an-accurate-comparison-of-perl-5-and-rakudo-star.html


Reply via email to