At 07:37 PM 3/26/2001 -0800, Russ Allbery wrote:
>Dan Sugalski <[EMAIL PROTECTED]> writes:
>
> > You're ignoring side-effects. The tied data may well be returned the
> > same every time it's accessed, but that doesn't mean that things aren't
> > happening behind the scenes. What if we were tracking the number of
> > times a scalar/hash/array was accessed? Memoizing would kill that.
>
>Hm.  I don't really understand why this would be significant unless you're
>actually benchmarking Perl's sort.  Unless you care about the performance
>of Perl's sort algorithm, the number of times each element is accessed in
>a sort is *already* indeterminate, being a function of the (hidden) sort
>implementation, and will vary a lot depending on how ordered the data
>already is.

The counting thing was just an example. The point was that someone could do 
something with the function calls or FETCHes on tied data. We don't 
currently have any places where we explicitly won't call a function or 
FETCH on access. (Or a STORE for that matter, since there are a bunch of 
places where stores to variables could be otherwise optimized away)

It's not that I don't mind saying "sort will memoize and may fetch your 
data only once", it's just that we have no current precedent.


                                        Dan

--------------------------------------"it's like this"-------------------
Dan Sugalski                          even samurai
[EMAIL PROTECTED]                         have teddy bears and even
                                      teddy bears get drunk

Reply via email to