Does Raku always parse?
Asked Answered
M

1

8

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
Mollescent answered 3/2, 2020 at 9:26 Comment(1)
time raku --stagestats -e '' gives me 0.137 for the parse stage. So that obviously has nothing to do with how much time it takes to actually parse a file.Greatnephew
U
8

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.

Unhurried answered 3/2, 2020 at 9:40 Comment(3)
Please compare this to other languages and VM's. Wasting more than 100 mSeconds in the Parsing stage does not make sense !Mollescent
As jnthn stated on #raku, the time shows up as parsing time, but is most likely mostly loading the Raku parser to parse your source code, not actually parsing your code. You could argue that that is a bug in the --stagestats code.Unhurried
@PeterBauer "does not make sense !" It's not clear if you (and/or your upvoter(s)) mean "I must be misunderstanding what is actually going on" or "You must be misunderstanding what we users need" or something else. (Once that's clarified it will be easier to reduce misunderstanding. As Liz's comment hopefully clarified, if what you meant by "Parsing stage" is time taken parsing then you misunderstood that aspect of Liz's answer. If what you meant was "Minimum time before run-time" then perhaps you misunderstood the "Only ... currently ... At this point in time" aspect of Liz's answer. Etc.)Ca

© 2022 - 2024 — McMap. All rights reserved.