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 2: However, merlyn concedes that the -s (file size operator) for showing off S.T. may actually be a bit contrived: Re: Benchmark, -s versus schwartzian.
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
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.