|Welcome to the Monastery|
When does it pay to use the schwartzian transform?by tphyahoo (Vicar)
|on Dec 16, 2005 at 18:44 UTC||Need Help??|
tphyahoo has asked for the wisdom of the Perl Monks concerning the following question:
When is the S.T. the way to go for sorting? And why? Does it win you efficiency, or is it mainly just for readability? Can some wise ones present the community with scenarios when you just should to use S.T., versus sorting some other way?
(decided to do a SOPW on this after posting Re^2: Sorting an array on two computed fields.)
I feel like this has probably already been discussed elsewhere, but my preliminary searches didn't pull any slam dunks, so please link to where the good stuff is if you know!
UPDATE: After reading some of the follow up links posted, I understand why "Schwartzian" sort performs better when the sort involves calling an expensive filesystem call, such as chcking file size. (See in particular Benchmark, -s versus schwartzian)
I now wonder... are there other general types of situation where it "pays"?
UPDATE 3: Merlyn also characterizes S.T. as a less "ideal", but much more maintainable, approximation of sort using another technique, the GRT (Guttman Rossler Transform): •Re^4: Benchmark, -s versus schwartzian