Subject: reverse and nreverse in nset performance review
From: Andreas Eder
Date: Sun, 7 Sep 2008 19:35:47 +0200
Hi Stavros,
>>>>> "Stavros" == Stavros Macrakis <macrakis at alum.mit.edu> writes:
Stavros> Andreas,
Stavros> In reviewing the performance of the set functions, I noticed that there was
Stavros> a call to "reverse" in do-merge-asym where an "nreverse" would make more
Stavros> sense. I wrote this code, so I was embarrassed to see this elementary
Stavros> oversight. But then I checked the revision log of nset, and discovered that
Stavros> it was you who had made this change in nset.lisp 1.20 ->
Stavros> 1.21<http://maxima.cvs.sourceforge.net/maxima/maxima/src/nset.lisp?r1=1.20&r2=1.21>(March
Stavros> 2007). Barton had also pointed this out to me last year, but I wasn't
Stavros> focussed on nset at the time.
Stavros> I had used nreverse in do-merge-asym because the list structure here is
Stavros> supposed to be guaranteed to be unshared. I assume you changed it to
Stavros> reverse in the belief that there are cases where it might be shared. If that
Stavros> is true, then there is a bug in do-merge-asym which should be corrected at
Stavros> the source, not symptomatically. If it is not true, the only effect will be
Stavros> to increase the amount of cons'ing, which is generally considered a bad
Stavros> thing. WHich is it?
Since it is about 1 1/2 years ago now I am no longer quite sure
what it was, but I think I was concerned about do-merge-asym might
share data.
If you are sure this is not so, you could surely change it back.
Sorry for any inconvenience that micht have given you.
Thanks,
Andreas
--
ceterum censeo redmondinem esse delendam.