You don't happen to have a PERL6LIB or -I pointed at a folder with loads
of stuff in it? If that is the case, having a single "use" statement
will cause rakudo to iterate through all files and subfolders, which can
take a long time if you've got, for example, your home directory in that
list (be it via -I. or PERL6LIB=. or explicitly mentioning the big folder)
There's many different tools to find out what's going on. For the "too
big perl6lib folder" problem, "strace" will give you a good hint by
giving one "stat" command for every file under your home directory.
Other than that, check "perl6 --stagestats -e 'blah'" or "perl6
--stagestats FooBar.p6", which will give timings for the different
phases, most notably "parse", "optimize", and "mbc". loading modules and
precompiling are part of the parse stage.
the "time" command will split your run time between "system" and "user"
time (as well as wallclock time). if "system" is particularly high, then
the program spends a lot of time asking the kernel to do stuff (such as
iterating files on the filesystem for the PERL6LIB case i've menitoned
above).
If none of that helps, startup can be profiled with "perl6
--profile-compile blah" and run time can be profiled with "perl6
--profile blah". The default output will be a html file that you can
just open in your browser to get an interactive performance inspection
tool thingie. Be aware, though, that it can become very big in the case
of --profile-compile, depending on the structure of the program being
compiled.
Hope any of that helps
- Timo
On 21/04/2019 05:58, ToddAndMargo via perl6-users wrote:
Hi All,
One liners are fast, but my own programs are very slow to start.
I download
https://github.com/perl6/gtk-simple/blob/master/examples/05-bars.pl6
To check it out and it also takes ten second to start.
What gives?
Many thanks,
-T