The stupid question is the question not asked PerlMonks

### Re^4: Reasons for Using "Perl6" (don't need to earn a living?)

by Laurent_R (Canon)
 on Dec 23, 2017 at 11:24 UTC ( #1206103=note: print w/replies, xml ) Need Help??

Yes, Perl 6 is generally slower than Perl 5, this has not been denied by any one. But very significant improvements have been made and more are to come.

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:

```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
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.

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:

```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
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.

Also, look at the Perl 5 and Perl 6 pieces of code: can anyone say that these languages are not closely related?

Create A New User
Node Status?
node history
Node Type: note [id://1206103]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (7)
As of 2018-07-17 23:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
Voting Booth?
It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?

Results (379 votes). Check out past polls.

Notices?