> On 21 Jan 2016, at 00:42, Alex Jakimenko (via RT) 
> <perl6-bugs-follo...@perl.org> wrote:
> 
> # New Ticket Created by  Alex Jakimenko 
> # Please include the string:  [perl #127330]
> # in the subject line of all future correspondence about this issue. 
> # <URL: https://rt.perl.org/Ticket/Display.html?id=127330 >
> 
> 
> Create a file with 10_000 lines:
> 
> for x in {1..10000}; do echo 'say ‘a’;' >> print.p6; done
> 
> And then time it:
> 
> time perl6 print.p6
> 
> It will take around 16 seconds to run.
> 
> You can also use 「print」 instead of 「say」, it does not matter.
> 
> The time grows linearly. I haven't done any serious benchmarks but please
> look at the attached graph, the data just speaks for itself.
> 
> Very important note (by Zoffix++):
> “It's all in compilation too.
> 17 seconds before it told me I got a syntax error.
> It takes 17s to run 10,000 prints on my box, but if I move them into a
> module and a sub and precompile the module, then I get 1.2s run. This is
> all compared to 0.2s run with Perl 5 on the same box”
> 
> Perhaps sub lookups are that slow?
> 
> Originally reported by zhmylove++.
> <perl6prints.png>

The delay is because of the parsing of the code:  using the —stagestats 
parameter, I get something like this on my machine:

$ time perl6 --stagestats print.p6 
Stage start      :   0.000
Stage parse      :   5.781
Stage syntaxcheck:   0.000
Stage ast        :   0.000
Stage optimize   :   0.527
Stage mast       :   1.088
Stage mbc        :   0.116
Stage moar       :   0.000
…
real    0m7.694s
user    0m7.546s
sys     0m0.194s

As you can see, most of the time is spent parsing the file, and then optimizing 
and then generating the bytecode.


This won’t get any faster until we spend time on optimizing grammars in NQP 
and/or MoarVM performance in general.



Liz

Reply via email to