Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re^3: Predefined Sort

by krusty (Hermit)
on Jun 20, 2008 at 17:25 UTC ( #693189=note: print w/ replies, xml ) Need Help??


in reply to Re^2: Predefined Sort
in thread Predefined Sort

Good point. I like reverse sort {$a <=> $b} @unsorted for readability/maintenance.
I think I'd probably use it, but is it really true that it executes just as quickly?
Doesn't reverse have to re-evaluate the list given to it before executing?
This would mean are evaluating the contents of the unsorted list twice: once to perform an ascending sort and again to perform a reverse.

I do a lot of large batch database processing, and I'm fond of anything which is more efficient. If I had to execute the sort a few million times in a loop or give it an extremely large list such as all rows in my database, I could see the single sort approach being more efficient. Please let me know if I'm missing some, but in the meantime I'm off to use Benchmark to try this out.


Comment on Re^3: Predefined Sort
Select or Download Code
Re^4: Predefined Sort
by kyle (Abbot) on Jun 20, 2008 at 17:36 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://693189]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (7)
As of 2014-09-16 03:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite cookbook is:










    Results (155 votes), past polls