raku -version This is Rakudo version 2020.01 built on MoarVM version 2020.01.1 implementing Perl 6.d.
Currently it looks like I can't start any Raku Perl6 program
with a runtime lower than about 130 ms (mostly startup time).
-Is Raku always reparsing the complete source on program start ?
-Is Raku caching any Bytecode ?
-So running even a onliner always takes >= 130 ms ?
time raku --stagestats hello_world.pl
Stage start : 0.000
Stage parse : 0.133
Stage syntaxcheck: 0.000
Stage ast : 0.000
Stage optimize : 0.002
Stage mast : 0.006
Stage mbc : 0.001
Stage moar : 0.000
hello world
hello world
TEST
hello world
real 0m0,183s
user 0m0,231s
sys 0m0,016s
The reason is that Raku, in contrast to RFC 2616, is Unicode conformant, and needs to be interpreted as a sole , thus preventing the grammar to properly parse a string containing in the sense expected by the HTTP protocol. Notice how attribute invalid is local to each component (e.g., the value for <type> is True, but for <path> is False ).
For example, Raku is parsed and executed using a Raku-style grammar. An example that's more practical to the common Raku user is the JSON::Tiny module, which can deserialize any valid JSON file; however, the deserializing code is written in less than 100 lines of simple, extensible code.
In Raku, rules are part of the grammar of the language. No separate parser exists for rules, as it did in Perl 5. This means that code, embedded in rules, is parsed at the same time as the rule itself and its surrounding code. For example, it is possible to nest rules and code without re-invoking the parser:
Is Raku always reparsing the complete source on program start ?
If you mean your script? Yes. Only modules are currently pre-compiled.
If you mean the entire Raku setting? No, then you would look at 100x more than that.
Is Raku caching any Bytecode ?
Installed modules and modules accessed through -Ilib
are cached in .precomp
directories.
So running even a onliner always takes >= 130 ms ?
On my machine it's around 120 msecs. But yeah, in that ballpark. At this point in time. Part of this is caused by a number of initializations that are done on startup: although a lot of care has been taken to make sure no unnecessary initializations are done at startup, this has not had the scrutiny of many years like Perl.
If you are comparing this to e.g. Perl, you should realize that Raku gives you Moose built in. If you run perl -MMoose -e ''
on my machine, the startup time is just a few milliseconds below that of Raku.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With