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.
| [reply] |
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.
| [reply] [d/l] |