Re:The Future of Perl
by b2gills on Tuesday March 30, 2021 @01:17PM
(#26637390)
Raku is a significantly higher level language than most languages. Which tends to lead to slowness.
Really it's faster in many places than it has any right to.
@a[1];
Is just shorthand for a subroutine call.
postcircumfix:< [ ] >( @a, 1 );
Which ends up calling a method.
@a.AT-POS( 1 );
Actually that is also a simplification as AT-POS is probably a multi method. Not to mention inheritance.
There is even a level under that, NQP. (simplified example below)
my $reified := nqp::getattr(@a, List, '$!reified');
my $result := nqp::atpos($reified, $pos);
All of those levels of indirection have a cost associated with them.
---
It just Rakudo on MoarVM has a bunch of optimizations to remove the needed complexity at some point. Either during compilation, or after it's been running for a while.
So with those optimizations it can sometimes beat other higher level languages.
(For some specific uses it may even sometimes meet or exceed the speed of low level languages like C/C++. Mainly for algorithmic reasons.)
Really it's faster in many places than it has any right to.
Is just shorthand for a subroutine call. Which ends up calling a method. Actually that is also a simplification as AT-POS is probably a multi method. Not to mention inheritance.There is even a level under that, NQP. (simplified example below)
All of those levels of indirection have a cost associated with them.---
It just Rakudo on MoarVM has a bunch of optimizations to remove the needed complexity at some point. Either during compilation, or after it's been running for a while.
So with those optimizations it can sometimes beat other higher level languages. (For some specific uses it may even sometimes meet or exceed the speed of low level languages like C/C++. Mainly for algorithmic reasons.)
More optimizations would always be nice though.