I did an experiment a while ago and found that string concatenation in a
loop was Ο(n²) in rakudo. I asked about it on irc and jnthn explained to me
that this was expected because strings are immutable (and therefore wasn't
worth RTing):
https://irclog.perlgeek.de/perl6/2015-12-15#i_11720228

(some encoding issue causes  Ο(n²) to have a bunch of Ãs in it)

On Fri, Jul 21, 2017 at 6:39 AM Ron Schmidt <perl6-bugs-follo...@perl.org>
wrote:

> # New Ticket Created by  Ron Schmidt
> # Please include the string:  [perl #131774]
> # in the subject line of all future correspondence about this issue.
> # <URL: https://rt.perl.org/Ticket/Display.html?id=131774 >
>
>
> From IRC:
>
> https://irclog.perlgeek.de/perl6-dev/2017-07-19#i_14893012
>
> https://irclog.perlgeek.de/perl6/2017-07-20#i_14899215
>
> Code example:
>
> for (50_000, 75_000) -> $limit {my $x; my $y = "x" x 100; $x ~= $y for
> (1..$limit); say "$limit: ", now - ENTER now}
>
> Gets a MoarVM memory panic from the eval bot for 75_000 constructing a
> 7.5 Meg string.  According to valgrind 50_000 was allocating 10GB of
> memory.  At a concat count of 150_000 Perl 5 finishes in hundredths of a
> second where p6 takes around a minute and the growth in time with p6 is
> clearly worse than linear.  "blead" updates as of July 20 include some
> improvements and timotimo on IRC mentioned that he is working on others.
>

Reply via email to