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

native string literal repetition ~100x slower than regular string literal repetition #5259

Closed
p6rt opened this issue Apr 23, 2016 · 4 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Apr 23, 2016

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

Searchable as RT127972$

@p6rt
Copy link
Author

p6rt commented Apr 23, 2016

From @MasterDuke17

time ./perl6 -e 'my str $a = "a" x 2**29;'

real 0m11.982s
user 0m11.387s
sys 0m0.583s

time ./perl6 -e 'my $a = "a" x 2**29;'

real 0m0.137s
user 0m0.123s
sys 0m0.013s

Oddly enough, it's fast when the native string is in a variable.

time ./perl6 -e 'my str $a = "a";my str $b = $a x 2**29;'

real 0m0.137s
user 0m0.127s
sys 0m0.010s

./perl6 -version
This is Rakudo version 2016.04-17-g5a14162 built on MoarVM version 2016.04
implementing Perl 6.c.

@p6rt
Copy link
Author

p6rt commented Dec 24, 2016

From @MasterDuke17

On Sat, 23 Apr 2016 07​:15​:55 -0700, ddgreen@​gmail.com wrote​:

time ./perl6 -e 'my str $a = "a" x 2**29;'

real 0m11.982s
user 0m11.387s
sys 0m0.583s

time ./perl6 -e 'my $a = "a" x 2**29;'

real 0m0.137s
user 0m0.123s
sys 0m0.013s

Oddly enough, it's fast when the native string is in a variable.

time ./perl6 -e 'my str $a = "a";my str $b = $a x 2**29;'

real 0m0.137s
user 0m0.127s
sys 0m0.010s

./perl6 -version
This is Rakudo version 2016.04-17-g5a14162 built on MoarVM version 2016.04
implementing Perl 6.c.

I ran the slow version with perf, this is the top of the report​:

  35.09% moar libmoar.so [.] MVM_string_latin1_encode_substr
  29.62% moar libmoar.so [.] MVM_string_compute_hash_code
  18.20% moar libmoar.so [.] MVM_mast_compile
  12.36% moar libmoar.so [.] MVM_string_latin1_decode
  1.72% moar [kernel.kallsyms] [k] clear_page_c_e
  1.37% moar libc-2.24.so [.] __memmove_avx_unaligned_erms

This is Rakudo version 2016.12-79-g266a168 built on MoarVM version 2016.12-19-ge2ffc35

@p6rt
Copy link
Author

p6rt commented Feb 4, 2017

From @MasterDuke17

Fixed in rakudo/rakudo@8878af83fe

@p6rt p6rt closed this as completed Feb 4, 2017
@p6rt
Copy link
Author

p6rt commented Feb 4, 2017

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

@p6rt p6rt added the perf 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
Development

No branches or pull requests

1 participant