<?xml version="1.0" encoding="windows-1252"?>
<node id="393979" title="Re: Wasting time thinking about wasted time" created="2004-09-26 13:14:05" updated="2004-12-16 11:31:10">
<type id="11">
note</type>
<author id="114691">
Aristotle</author>
<data>
<field name="doctext">
&lt;blockquote&gt;&lt;p&gt;It's a lot longer and wouldn't fit on a slide&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;I don't see why it has to be. You can level the playing field without any significant difference.&lt;/p&gt;

&lt;code&gt;
use Benchmark qw( timethese );
my @files = glob "/bin/*";
timethese( -2, {
    Ordinary =&gt; sub {
        () = sort { -M $a &lt;=&gt; -M $b } @files
    },
    Schwartzian =&gt; sub {
        () = 
            map $_-&gt;[0],
            sort { $a-&gt;[1] &lt;=&gt; $b-&gt;[1] }
            map [ $_, -M ],
            @files;
        },
    },
);
&lt;/code&gt;

&lt;p&gt;And that's it. Note that I always use sub refs with [cpan://Benchmark], so the package issues don't even come up. You could assign to an actual array if you don't feel like explaining the &lt;tt&gt;() = ..&lt;/tt&gt; construct, but it wouldn't make an appreciable difference in the code.&lt;/p&gt;

&lt;div class="pmsig pmsig-114691"&gt;
&lt;p align="right"&gt;&lt;em&gt;Makeshifts last the longest.&lt;/em&gt;&lt;/p&gt;
&lt;/div&gt;</field>
<field name="root_node">
393128</field>
<field name="parent_node">
393128</field>
</data>
</node>
