Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Something is extremely slow with a look with string concat in Rakudo on the JVM #3256

Closed
p6rt opened this issue Oct 27, 2013 · 4 comments
Closed
Labels

Comments

@p6rt
Copy link

@p6rt p6rt commented Oct 27, 2013

Migrated from rt.perl.org#120380 (status was 'resolved')

Searchable as RT120380$

@p6rt
Copy link
Author

@p6rt p6rt commented Oct 27, 2013

From @masak

<pippo> Hello. Does anybody tried this on rakudo-jvm? my $file = "";
for ^20000 {$file ~= "$_;"}; say $file ~~ /(\d+) +% ';'/;
<masak> pippo​: ...probably not?
<FROGGS> no, not exactly this line... why?
<pippo> It takes too much long to execute!
<FROGGS> pippo​: how too muh long?
<pippo> Really I do not know. It blows me out before it finishes.
Niecza does it in few seconds.
<masak> pippo​: that sounds like a bug, then.
<pippo> I do not know. I arrived at this trying to understand why
slurping a long file about 20'000 lines takes so long (lines slurp
"myfile").
<masak> pippo​: it would be interesting to see timings of this for <p5
niecza r-p r-j>
<masak> on your machine.
<pippo> I'll do...
<pippo> masak​: Niecza​: realI0m7.866s userI0m13.510s sysI0m0.135s (but
changed 20'000 to 10'000 in the for loop)
<masak> pippo​: nice.
<pippo> masak​: rakudo-jvm I am still waiting after 4 minutes
<masak> pippo​: ok, submitting rakudobug.

Niecza's 7 s result feels reasonable. 4 minutes doesn't feel
reasonable. This ticket can be closed when things feel reasonable. :)

@p6rt
Copy link
Author

@p6rt p6rt commented Oct 17, 2014

From @usev6

To me it looks like the loop and the string concat are okay-ish (this is on a "not too beefy" machine (i3 3.33 GHz, 8 GiB RAM)​:

$ perl6-m -e 'my $file = ""; for ^20000 {$file ~= "$_;"};'

real 0m0.500s
user 0m0.436s
sys 0m0.060s

$ perl6-p -e 'my $file = ""; for ^20000 {$file ~= "$_;"};'

real 0m1.717s
user 0m1.588s
sys 0m0.116s

$ perl6-j -e 'my $file = ""; for ^20000 {$file ~= "$_;"};'

real 0m10.312s
user 0m19.917s
sys 0m0.352s

The smartmatch makes it somewhat slower (but much slower for parrot)​:

$ perl6-m -e 'my $file = ""; for ^20000 {$file ~= "$_;"}; $file ~~ /(\d+) +% ";"/;'

real 0m1.210s
user 0m1.140s
sys 0m0.064s

$ perl6-p -e 'my $file = ""; for ^20000 {$file ~= "$_;"}; $file ~~ /(\d+) +% ";"/;'

real 0m12.436s
user 0m12.141s
sys 0m0.240s

$ perl6-j -e 'my $file = ""; for ^20000 {$file ~= "$_;"}; $file ~~ /(\d+) +% ";"/;'

real 0m13.147s
user 0m25.122s
sys 0m0.428s

And now with say (STDOUT redirected to files, which have 20002 lines each) which makes it significantly slower​:

$ perl6-m -e 'my $file = ""; for ^20000 {$file ~= "$_;"}; say $file ~~ /(\d+) +% ";"/;' > foo1

real 0m20.079s
user 0m19.217s
sys 0m0.776s

$ perl6-p -e 'my $file = ""; for ^20000 {$file ~= "$_;"}; say $file ~~ /(\d+) +% ";"/;' > foo2

real 1m58.058s
user 1m56.899s
sys 0m0.328s

$ perl6-j -e 'my $file = ""; for ^20000 {$file ~= "$_;"}; say $file ~~ /(\d+) +% ";"/;' > foo3

real 0m38.323s
user 0m59.948s
sys 0m0.536s

All in all I'd say that's reasonable for the time being. (Especially the times with JVM are nowhere near 4 minutes.) If you disagree, please reopen the ticket.

1 similar comment
@p6rt
Copy link
Author

@p6rt p6rt commented Oct 17, 2014

From @usev6

To me it looks like the loop and the string concat are okay-ish (this is on a "not too beefy" machine (i3 3.33 GHz, 8 GiB RAM)​:

$ perl6-m -e 'my $file = ""; for ^20000 {$file ~= "$_;"};'

real 0m0.500s
user 0m0.436s
sys 0m0.060s

$ perl6-p -e 'my $file = ""; for ^20000 {$file ~= "$_;"};'

real 0m1.717s
user 0m1.588s
sys 0m0.116s

$ perl6-j -e 'my $file = ""; for ^20000 {$file ~= "$_;"};'

real 0m10.312s
user 0m19.917s
sys 0m0.352s

The smartmatch makes it somewhat slower (but much slower for parrot)​:

$ perl6-m -e 'my $file = ""; for ^20000 {$file ~= "$_;"}; $file ~~ /(\d+) +% ";"/;'

real 0m1.210s
user 0m1.140s
sys 0m0.064s

$ perl6-p -e 'my $file = ""; for ^20000 {$file ~= "$_;"}; $file ~~ /(\d+) +% ";"/;'

real 0m12.436s
user 0m12.141s
sys 0m0.240s

$ perl6-j -e 'my $file = ""; for ^20000 {$file ~= "$_;"}; $file ~~ /(\d+) +% ";"/;'

real 0m13.147s
user 0m25.122s
sys 0m0.428s

And now with say (STDOUT redirected to files, which have 20002 lines each) which makes it significantly slower​:

$ perl6-m -e 'my $file = ""; for ^20000 {$file ~= "$_;"}; say $file ~~ /(\d+) +% ";"/;' > foo1

real 0m20.079s
user 0m19.217s
sys 0m0.776s

$ perl6-p -e 'my $file = ""; for ^20000 {$file ~= "$_;"}; say $file ~~ /(\d+) +% ";"/;' > foo2

real 1m58.058s
user 1m56.899s
sys 0m0.328s

$ perl6-j -e 'my $file = ""; for ^20000 {$file ~= "$_;"}; say $file ~~ /(\d+) +% ";"/;' > foo3

real 0m38.323s
user 0m59.948s
sys 0m0.536s

All in all I'd say that's reasonable for the time being. (Especially the times with JVM are nowhere near 4 minutes.) If you disagree, please reopen the ticket.

@p6rt p6rt closed this Oct 17, 2014
@p6rt
Copy link
Author

@p6rt p6rt commented Oct 17, 2014

@usev6 - Status changed from 'new' to 'resolved'

@p6rt p6rt added the Bug label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant