Re: SUBSTR() with replacement or lvalue performance issues
- From: xhoster@xxxxxxxxx
- Date: 11 Nov 2008 17:14:06 GMT
Ilya Zakharevich <nospam-abuse@xxxxxxxxx> wrote:
[A complimentary Cc of this posting was NOT [per weedlist] sent to....
Michele Dondi
<bik.mido@xxxxxxxxxxxxx>], who wrote in article
<bs38h49bu6oanughiuvgdgr8rfen2v8fh0@xxxxxxx>:
ISTR that the lvaluedness of substr()'s return value, as long as the
fact that you can EVEN take references of it and modify the string
with a sort of action-at-distance was put there specifically for
performance issues. At some point there were problems with
substitutions having a lenght larger than the substituted IalsoIRC,
but they should be solved in recent enough perls.
See: <http://perlmonks.org/?node_id=498434>
Simple experiments show that it is still buggy with 5.8.8: code below
returns
change_nth 7, 'lazy', map{ substr $bigScalar, $_->[0], $_->[1] }
[0,3], [4,5], [10,5], [16,3], [20,5], [26,4], [31,3], [35,4], [40,3];
print "$bigScalar\n";
I don't see this as a bug with substr. "Map" doesn't alias the values
it returns, it copies them. So the magic is no longer there, just as it
isn't present in $x if you do:
my $x=substr $bigScalar, 1, 4;
So if it's a bug, it is a bug with map, not substr.
Xho
--
-------------------- http://NewsReader.Com/ --------------------
The costs of publication of this article were defrayed in part by the
payment of page charges. This article must therefore be hereby marked
advertisement in accordance with 18 U.S.C. Section 1734 solely to indicate
this fact.
.
- Follow-Ups:
- Re: SUBSTR() with replacement or lvalue performance issues
- From: Ilya Zakharevich
- Re: SUBSTR() with replacement or lvalue performance issues
- From: sln
- Re: SUBSTR() with replacement or lvalue performance issues
- References:
- SUBSTR() with replacement or lvalue performance issues
- From: sln
- Re: SUBSTR() with replacement or lvalue performance issues
- From: Ilya Zakharevich
- SUBSTR() with replacement or lvalue performance issues
- Prev by Date: Re: Comparing audio files
- Next by Date: Re: Why does the following statement work ?
- Previous by thread: Re: SUBSTR() with replacement or lvalue performance issues
- Next by thread: Re: SUBSTR() with replacement or lvalue performance issues
- Index(es):
Relevant Pages
|