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

Re^2: schwartzian transform

by Laurent_R (Canon)
on Oct 14, 2014 at 09:41 UTC ( #1103698=note: print w/replies, xml ) Need Help??

in reply to Re: schwartzian transform
in thread schwartzian transform

I don't really see how an Orcish manoeuvre would improve a Schwartzian Transform sort.

Replies are listed 'Best First'.
Re: schwartzian transform
by jonadab (Parson) on Oct 14, 2014 at 10:57 UTC

    In this particular case, I'm not sure it would. In general, it can, in situations where the (chronologically) first transform consumes a lot of time for some reason, if you have duplicated data in the list that you are sorting. Not needing to perform the same time-intensive computation repeatedly saves time. But in this case, it doesn't look like there are going to be a lot of duplicate data (though only someone with access to the original poster's real data could say that for sure), and furthermore that regular expression in the first transform doesn't look like it would be much of a bottleneck, so I'm not sure much if anything would be gained.

Re^3: schwartzian transform
by Ea (Chaplain) on Oct 14, 2014 at 13:45 UTC
    You're right, Laurent. You only calculate the sort value once in the first call to map, so there's no savings to be made by caching.

    Those two techniques must be stored together in the "neat things to use with sort" area of my brain. Apologies.

    Sometimes I can think of 6 impossible LDAP attributes before breakfast.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (1)
As of 2023-03-26 03:34 GMT
Find Nodes?
    Voting Booth?
    Which type of climate do you prefer to live in?

    Results (63 votes). Check out past polls.