Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: An APL trick for the Schwartzian Transform

by Aristotle (Chancellor)
on Nov 16, 2002 at 02:28 UTC ( #213342=note: print w/replies, xml ) Need Help??


in reply to An APL trick for the Schwartzian Transform

Actually, if you’re at that point, you can make things a whole lot more efficient:

my @sorted = @unsorted[ do { my @cache = map key_from( $_ ), @unsorted; sort { $cache[$b] <=> $cache[$a] } 0 .. $#cache } ];

The Schwartzian Transform suffers severely from creating a huge number of tiny anonymous arrays. This form creates only one extra array and one extra list. The larger the array and the less expensive the key calculation routine, the larger the impact this will have.

Makeshifts last the longest.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://213342]
help
Chatterbox?
erix imagines trump-nominees poring over the wikipedia-page of their ministery's subject
LanX is not affraid of Trump ...
LanX ... me is scared of people voting for Trumps
[erix]: until good old Putin lobs a bomb on Berlin :)
[Your Mother]: “I’m afraid of Americans…”

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (6)
As of 2017-01-20 00:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you watch meteor showers?




    Results (173 votes). Check out past polls.