develooper Front page | perl.perl5.porters | Postings from July 2004

Re: optimizing Short circuiting sort method based on [M]

Nicholas Clark
July 21, 2004 06:15
Re: optimizing Short circuiting sort method based on [M]
Message ID:
On Thu, Jul 15, 2004 at 10:58:06PM -0500, david nicol wrote:
> On Tue, 2004-07-13 at 14:34, Nicholas Clark wrote:
> > 
> > I'm not sure how worthwhile this really is, but I think it means that
> > there's no argument about what's the most efficient way to reverse sort
> > a list - don't write a reversed comparison function, simply write
> > reverse sort ....

> I wonder if this could be turned into yet another context -- "reverse
> list" context -- causing any returning array to get reversed on the
> stack before being returned, in a lighter way than calling the reverse
> function.  Just another idea.

Based on the number of regression tests that I broke while implementing
this, I don't think that it's a very common scenario, so would be complicating
the general case for something rather specific and very rare. Plus it's unclear
how to make any of it work in a backwards compatible way.

Nicholas Clark Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About