-
Notifications
You must be signed in to change notification settings - Fork 560
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
COW speedup lost after e8c6a474 #13878
Comments
From @rjbsI have this test program: $x = "x" x 1_000_000; On my box (OS X, will attach perl -V shortly) this program takes 90s to run on 5.18 and 5.20. It takes a fraction of a second on 5.19.11. The change in speed occurs at: commit e8c6a47 Implement "max waste" thresholds to avoid problems with COW and deliberately overallocated pvs Matthew Horsfall reports no slowdown on his Ubuntu box. Obviously it'd be great to get this sorted out for 5.20.1. -- |
From @rjbsSummary of my perl5 (revision 5 version 20 subversion 0) configuration: Characteristics of this binary (from libperl): |
From @rjbsOn Wed May 28 09:04:19 2014, rjbs wrote:
I foolishly put this bug in the wrong place to start, and am replying to it here simply to trigger a mail to p5p. -- |
From @jkeenanOn Wed May 28 09:04:19 2014, rjbs wrote:
[snip]
I am not getting a slowdown on either of two Linux machines. In what follows I use only released versions, compiled from source without threading. #1: current laptop $ which perl $ time perl ~/learn/perl/rjbs_speed.pl real 0m0.061s $ perlbrew switch perl-5.18.2 $ which perl $ time perl ~/learn/perl/rjbs_speed.pl real 1m17.144s #2: older Linode $ perl -v This is perl 5, version 20, subversion 0 (v5.20.0) built for i686-linux $ time perl rjbs_speed.pl real 0m0.194s $ time /usr/local/bin/perl5.18.1 rjbs_speed.pl real 1m43.419s Could there be an OS-specific aspect to this problem? Thank you very much. |
The RT System itself - Status changed from 'new' to 'open' |
From @jkeenanOn Wed May 28 13:33:40 2014, jkeenan wrote:
[snip Linux results ]
Yes, there could be. I was able to reproduce rjbs's results on Darwin -- a very old Darwin! (I had to modify rjbs's program to take a command-line argument for number of iterations.) I compared 5.18.0 and 5.20.0, both built from source. There did not appear to be significant differences. Performance degraded rapidly as the number of iterations increased; I control-C-ed runs of 300,000. However, I then checked out the commit immediately preceding the one rjbs cited and built a perl from that. Using that, rjbs's program went like lightning. I was able to do a run of 3,000,000 with no problem. Please see attached file. Let's get reports from other OSes. Thank you very much. |
From @jkeenan# 5.18.0 $ time /usr/local/bin/perl5.18.0 rjbs_speed.pl 150000 $ time /usr/local/bin/perl5.18.0 rjbs_speed.pl 200000 # v5.19.11-45-gc8180b0; see perl -V below $ time ./perl -Ilib ~/learn/perl/rjbs_speed.pl 150000 $ time ./perl -Ilib ~/learn/perl/rjbs_speed.pl 200000 $ time ./perl -Ilib ~/learn/perl/rjbs_speed.pl 3000000 # 5.20.0 $ time perl rjbs_speed.pl 150000 $ time perl rjbs_speed.pl 200000 ##### |
From @demerphqOn 28 May 2014 23:53, James E Keenan via RT <perlbug-followup@perl.org>wrote:
Can you add something like use Devel::Peek; and then send us the last couple of lines. It will print a lot of "x"s and CUR = 1000000 Id like to see that. (We need to patch Devel::Peek dump to be a little Yves |
From @rjbs* demerphq <demerphq@gmail.com> [2014-05-28T19:11:21]
I would be delighted to do so! (type type type) I ran it piped to 'grep -v xxxxxx' and I get, on perl 5.20.0: ~$ perl terastring.pl |& grep -v xxxxxx When I use perl 5.19.11: ~$ perl terastring.pl |& grep -v xxxxxx -- |
From @jkeenanOn Wed May 28 16:12:07 2014, demerphq wrote:
Results on older Darwin appear similar to what rjbs got. See file attached. |
From @jkeenan$ /usr/local/bin/perl5.18.0 121975-rjbs_speed.pl 100000 2> xyz; grep -v xxxxxx xyz;rm xyz $ ./perl -v | head -2 | tail -1 $ /usr/local/bin/perl5.20.0 121975-rjbs_speed.pl 100000 2> xyz; grep -v xxxxxx xyz;rm xyz |
From @demerphqOn 29 May 2014 01:31, Ricardo Signes <perl.p5p@rjbs.manxome.org> wrote:
So there is the reason. For some reason the slow builds are preallocating a Obviously you *could* raise these thresholds, for instance to 4000 and this However I think the real problem we need to get to the bottom of is why it On Linux we see this: $ cat ../t2.pl $ time ./perl -Ilib ../t2.pl 2>&1 | grep -v xxxx real 0m0.139s Note the LEN-CUR == 2 compared to your run where LEN-CUR==3520. If we look SV = PV(0x1803558) at 0x180f810 We can see it is LEN-CUR==2400. I suspect the Linux results are because of this: ./perl -Ilib -V:d_malloc_size Which affects the following logic in sv.c: #ifdef Perl_safesysmalloc_size In Linux we compile the second branch, and in OSX and BSD's I think that When we do something like my $x= "x" x 1000000; we end up doing SvGROW(sv,1000000); Assuming $x was originally empty we will try to malloc() K+2 bytes, one On linux this ends up with SvLEN()==1000002 and SvCUR()==1000000. On systems where Perl_safesysmalloc_size() is defined we set the SvLEN() to Basically there is a big difference when Perl or a perl user decides to There are multiple optimisations at multiple levels operating and clashing 1. Deliberate preallocation of a buffer - useful on OS'es with a braindead So one option would be to stop using Perl_safesysmalloc_size(). Another Regardless I feel like there is a bit of a clash of concepts here that we -- |
From @demerphqOn 29 May 2014 11:11, demerphq <demerphq@gmail.com> wrote:
As this is the easiest to do to prove this is actually the problem I have commit ce861ea temporary fix for [perl #121975] COW speedup lost after e8c6a47 Disable use of Perl_safesysmalloc_size by default. Only use it when Using Perl_safesysmalloc_size() perl cannot tell a deliberately How this affects performance as a whole on the affected platforms I do not Yves -- |
From @bulk88On Wed May 28 13:33:40 2014, jkeenan wrote:
Where is rjbs_speed.pl? Its not attached to this ticket. -- |
From @rjbs* demerphq <demerphq@gmail.com> [2014-05-29T05:36:13]
As you suspected: ~/code/perl5$ time ./perl -I lib ~/terastring.pl |& grep -v xx -- |
From @rjbs* bulk88 via RT <perlbug-followup@perl.org> [2014-05-29T07:49:08]
It's the two-line program described in the ticket. With Devel::Peek added: # terastring.perl Dump($x); -- |
From @jkeenanOn 5/29/14 7:49 AM, bulk88 via RT wrote:
It was just rjbs's 2-liner put into a program, then provision for |
From @jhiOn Thursday-201405-29, 8:02, Ricardo Signes wrote:
FWIW, in an OS X 10.9.3 (I tweaked the for loop to do the copy "only" * with blead time ./perl -Ilib /tmp/ts.pl 2>&1 |grep -v xxx * with 5.20.0 time ./perl -Ilib /tmp/ts.pl 2>&1 |grep -v xxx * with 5.18.2 (from macports) time perl /tmp/ts.pl 2>&1 |grep -v xxx |
From @bulk88On Wed May 28 13:33:40 2014, jkeenan wrote:
strawberry 5.18, VC blead 5.21, AP 5.10 Owner@delld620 ~ This is perl 5, version 18, subversion 0 (v5.18.0) built for MSWin32-x86-multi-thread-64int Copyright 1987-2013, Larry Wall Perl may be copied only under the terms of either the Artistic License or the Complete documentation for Perl, including FAQ lists, should be found on Owner@delld620 ~ real 0m2.203s Owner@delld620 ~ This is perl 5, version 21, subversion 1 (v5.21.1 (v5.21.0-29-g1abbcfa)) built for MSWin32-x86-multi-thread Copyright 1987-2014, Larry Wall Perl may be copied only under the terms of either the Artistic License or the Complete documentation for Perl, including FAQ lists, should be found on Owner@delld620 ~ real 0m0.094s Owner@delld620 ~ This is perl, v5.10.0 built for MSWin32-x86-multi-thread Copyright 1987-2007, Larry Wall Binary build 1003 [285500] provided by ActiveState http://www.ActiveState.com Perl may be copied only under the terms of either the Artistic License or the Complete documentation for Perl, including FAQ lists, should be found on Owner@delld620 ~ real 0m2.188s Owner@delld620 ~ -- |
From @jkeenanOn Thu May 29 05:03:15 2014, perl.p5p@rjbs.manxome.org wrote:
Confirmable on the older Darwin as well: ### $ time ./perl -Ilib ~/learn/perl/p5p/121975-rjbs_speed.pl 150000 $ time ./perl -Ilib ~/learn/perl/p5p/121975-rjbs_speed.pl 200000 $ time ./perl -Ilib ~/learn/perl/p5p/121975-rjbs_speed.pl 3000000 And with the Devel::Peek check: ### |
From @cpansproutOn Thu May 29 02:12:26 2014, demerphq wrote:
How about making the threshold a percentage, rather than a fixed number of bytes?
Well, at least 5.20 was no slower than 5.18 in that case, and faster in others. :-) -- Father Chrysostomos |
From @maukeOn Thu May 29 02:36:38 2014, demerphq wrote:
Any news? Should this ticket stay open? (It's listed in perl5201delta.) |
From @jkeenanOn Fri Feb 26 10:31:01 2016, mauke- wrote:
On the older Darwin on which I reported, Yves' patch, while it did not get back the speeds reported up through v5.19.11-45-gc8180b0, did improve performance considerably. So I don't need to have the ticket remain open ... but let's see what rjbs has to say, particularly on a more up-to-date Darwin. Thank you very much. -- |
From @iabynOn Fri, Feb 26, 2016 at 03:56:36PM -0800, James E Keenan via RT wrote:
I think the ticket should stay open. There's still a whole bunch of -- |
From @rjbsOn Mon Feb 29 02:11:53 2016, davem wrote:
I'd probably like to see those become their own tickets, but as it stands I'm happy to let you own this issue and the structure of the tickets to handle it. ;) -- |
Migrated from rt.perl.org#121975 (status was 'open')
Searchable as RT121975$
The text was updated successfully, but these errors were encountered: