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

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

From:
Nicholas Clark
Date:
July 21, 2004 06:15
Subject:
Re: optimizing Short circuiting sort method based on [M]
Message ID:
20040721131450.GU784@plum.flirble.org
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



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About