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
OOK hack example in perlguts is outdated with COW #13990
Comments
From @ntyniThis is a bug report for perl from Niko Tyni <ntyni@debian.org>, Trying to fix Devel-Size [rt.cpan.org #95493] for Perl 5.20, % perl5182 -MDevel::Peek -le '$a="12345"; $a=~s/.//; Dump($a)' % perl5200 -MDevel::Peek -le '$a="12345"; $a=~s/.//; Dump($a)' This changed with commit v5.19.0-246-g13b0f67, "re-enable Copy-on-Write The example is from the 'Offsets' section in perlguts, so at least that Flags: Site configuration information for perl 5.18.2: Configured by Debian Project at Mon Jul 14 20:39:08 UTC 2014. Summary of my perl5 (revision 5 version 18 subversion 2) configuration: Locally applied patches: @INC for perl 5.18.2: Environment for perl 5.18.2: |
From @demerphqOn 18 July 2014 08:58, Niko Tyni <perlbug-followup@perl.org> wrote:
I would assume this is a serious performance failure. COW clashing with Yves |
The RT System itself - Status changed from 'new' to 'open' |
From @arcdemerphq <demerphq@gmail.com> wrote:
Yes, it seems so: $ for f in 5.18.2 5.20.0; do time perl$f -wE 'say for "", $^V; for (1 v5.18.2 real 0m19.769s v5.20.0 real 0m39.145s -- |
From @iabynOn Mon, Jul 21, 2014 at 03:34:00PM +0100, Aaron Crane wrote:
Note that this is in fact a bug fix that has performance loss as a $ perl5180 -le'$_="ABC"; s/.//; print ord eval q{$&}' Basically in general, a pattern match has to make a temporary copy of the However, when the match includes a substitution, things become more Note that s/.// is a bit of special case. Replace it with s/(.)// say, But I do rather wonder whether COW could be improved to still share the But its all very messy and too much for my brain at this time of night. -- |
From @demerphqOn 23 July 2014 23:19, Dave Mitchell <davem@iabyn.com> wrote:
Removing characters from the front or back of a string efficiently is I really think that the long history of "you dont need $&" shows that On the other hand correctness is pleasing. :-) I was wondering if we could wriggle out of this conundrum with a new I cant help but observe that I already used a modifier to work around the I wonder if we would have success if we had the opposite modifier (say /P) Yves |
From @cpansproutOn Thu Jul 24 00:18:47 2014, demerphq wrote:
Wasn’t this suggested as /n or something similar last year? I seem to remember you supported the idea and there were several messages back and forth in which you might have thought I disagreed, though I did not. -- Father Chrysostomos |
From @cpansproutOn Wed Jul 23 14:19:47 2014, davem wrote:
OOK offsets are stored in the string buffer itself. But perhaps we could bring the old IV system back at least for COW scalars. -- Father Chrysostomos |
From @cpansproutOn Thu Jul 17 23:58:03 2014, ntyni@debian.org wrote:
Here is one way: $ ./perl -Ilib -MDevel::Peek -le '$a=""; $a .= ""; Dump($a)' Note the LEN. Then extend the string to one less than that: $ ./perl -Ilib -MDevel::Peek -le '$a=""; $a .= "123456789"; Dump($a)' OK, it’s still 10. Now try substitution: $ ./perl -Ilib -MDevel::Peek -le '$a=""; $a .= "123456789"; $a=~s/.//; Dump($a)' -- Father Chrysostomos |
From @iabynOn Sun, Sep 07, 2014 at 07:17:57AM -0700, Father Chrysostomos via RT wrote:
But as I pointed out earlier in this thread, strings are normally expected -- |
From @cpansproutOn Mon Sep 08 04:51:05 2014, davem wrote:
I have done s/// on just the beginning enough times that I think it would be worth optimising it. I have updated the docs in commit f942a0d, but I think this ticket should stay open (but not block 5.22) until the optimisation can be implemented. -- Father Chrysostomos |
From david@justatheory.comCan I just say how much I love the subject of this thread? D |
Migrated from rt.perl.org#122322 (status was 'open')
Searchable as RT122322$
The text was updated successfully, but these errors were encountered: