in reply to Re^3: Reasons for Using "Perl6" (don't need to earn a living?)
in thread Reasons for Using Perl 6
Two orders of magnitude? This is a factor of 100. So you're saying that Perl 6 is at least 100 times slower. Let's see.
This is a very simple benchmark on a loop:
So here, the first Perl 6 test took 21 seconds, which is a bit more than 5 times slower than Perl 5. That's not anywhere near two orders of magnitude. Just adding the int hint (no pun intended) for the compiler to optimize its handling of the integer variable led to 9 seconds, so that, in the last test, Perl 6 is about 2.25 slower than Perl 5. I wish it were not so, but that's where we stand. There is definitely room for improvement. A year ago, or so, it might have been slower by a factor of 10. What will it be in a year from now? I really don't know, but performance improvements are being made almost every single week, so it is likely to improve significantly.C:\Users\Laurent>perl -E "my $c = 1; my $start = time; while (1) { $c+ ++; last if (2 * $c ) > 50000000 ; }; say time - $start; say $c" 4 25000001 C:\Users\Laurent>perl6 -e "my $c = 1; my $start = time; while (1) { $c +++; last if (2 * $c ) > 50000000 ; }; say time - $start; say $c" 21 25000001 C:\Users\Laurent>perl6 -e "my int $c = 1; my $start = time; while (1) +{ $c++; last if (2 * $c ) > 50000000 ; }; say time - $start; say $c" 9 25000001
And, BTW, I know the results are low resolution, but that's not a Perl 6 limitation: Perl 6 has a built-in now function giving a much higher resolution:
For some other computations, Perl 6 will slower than Perl 5 by a significantly higher margin, perhaps 10 to 20 times, but, again, it is improving all the time.C:\Users\Laurent>perl6 -e "my int $c = 1; my $start = now; while (1) { + $c++; last if (2 * $c ) > 50000000 ; }; say now - $start; say $c" 8.9252329 25000001
Also, look at the Perl 5 and Perl 6 pieces of code: can anyone say that these languages are not closely related?
|
|---|