in reply to Re^2: Custom sort with string of numbers
in thread Custom sort with string of numbers

Does that mean that splitting or concatenating in sort is optimized away after the first time?

No. What happens is that since the sort algorithm is better, fewer comparisons are done (and wild worst case things are avoided) therefore the impact of making a comparison faster is less. The Schwartzian Transform makes comparisons faster by pre-calculating whatever is required to get to the values (maybe splitting a line or whatever).

At the end of the day, efficiency does matter and at some design point, it makes sense to spend more time coding and/or give up a bit in terms of clarity for that improved performance. However that should be a conscious decision - not a one size fits all deal.

  • Comment on Re^3: Custom sort with string of numbers