<span style="font-family: courier new,monospace;">I just thought I&#39;d follow up on the discussion I started last week.</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">(Thanks to all who participated!)</span><br style="font-family: courier new,monospace;">

<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">Attached is my current version of the test harness based on</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">Abram&#39;s work, and most if not all supplied routines and</span><br style="font-family: courier new,monospace;">

<span style="font-family: courier new,monospace;">suggestions (even your&#39;s Uri, now that I had the time to</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">look!)</span><br style="font-family: courier new,monospace;">

<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">My conclusions:</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">1/ Abram&#39;s &#39;nounpacksort&#39; was the most efficient.</span><br style="font-family: courier new,monospace;">

<span style="font-family: courier new,monospace;">2/ Uri&#39;s rehash of my original code wins as the most readable.<br>   (I know it had ugly &#39;C&#39; constructs, but I couldn&#39;t think of a better<br>   more Perl&#39;ish way (see bonus points below))<br>

3/ My original code wasn&#39;t all that bad :-)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">4/ Adding the tuple idea yields noticeable improvements.</span><br style="font-family: courier new,monospace;">

<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">Uri also gets bonus points for showing me that I could do this</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">kind of in-place substitution... on a list:</span><br style="font-family: courier new,monospace;">

<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">   s/ //g foreach @oids;</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;">

<span style="font-family: courier new,monospace;">Uri also gets extra bonus points for teaching me to use<br>regex&#39;s with embedded code.  I always knew it could be done<br>but never spent the time to learn it, nor recognize when<br>

it would be useful.  Now (dammit), thanks to Uri, I know.<br><br>    s/(\d+)/sprintf(&#39;%8s&#39;, $1)/ge foreach @oids;</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;">

<span style="font-family: courier new,monospace;">And oh yes... printing the &#39;number as a string&#39; _is_ faster<br>than printing a &#39;number as a number&#39;!<br><br>Here&#39;s the benchmark results:<br><br>                     s/iter    Improvement<br>

abram_whilecmp         7.05             --<br>indy_slow_sort         6.89             2%<br>henrys_sort            5.52            28%<br>fulko_sort_uri         1.79           294%<br>fulko_sort_orig        1.77           299%<br>

abram_swartzpacksort   1.55           356%<br>abram_packsort         1.41           400%<br>fulko_sort             1.14           519%<br>abram_nounpacksort    0.905           679%<br><br>Oh... another thing I learned...</span><br style="font-family: courier new,monospace;">

<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">When running benchmarks... turn off Centrino auto-CPU-speed-mechanism!<br>I was having a hell of a time trying to figure out<br>

why my results were always all over the map.  :-(</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">Finally, for those who want to see the (current) winners,<br>

without having to look at the attachment, they are:</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">For Readability:</span><br style="font-family: courier new,monospace;">

<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">sub fulko_sort_uri {</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    my @oids = @_;</span><br style="font-family: courier new,monospace;">

<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    s/(\d+)/sprintf(&#39;%8s&#39;, $1)/ge foreach @oids;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    @oids = sort @oids;</span><br style="font-family: courier new,monospace;">

<span style="font-family: courier new,monospace;">    s/ //g foreach @oids;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    return @oids;</span><br style="font-family: courier new,monospace;">

<span style="font-family: courier new,monospace;">}</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">For Fastest:</span><br style="font-family: courier new,monospace;">

<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">sub abram_nounpacksort {</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    my @data = map { [ split(/\./, $_) ] } @_;</span><br style="font-family: courier new,monospace;">

<span style="font-family: courier new,monospace;">    my @sorted = map { $_-&gt;[1] }</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        sort { $a-&gt;[0] cmp $b-&gt;[0] }</span><br style="font-family: courier new,monospace;">

<span style="font-family: courier new,monospace;">            map { [pack(&quot;N*&quot;,@$_),$_] } @data;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    @sorted = map { join(&quot;.&quot;,@$_) } @sorted;</span><br style="font-family: courier new,monospace;">

<span style="font-family: courier new,monospace;">    return @sorted;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">}</span><br style="font-family: courier new,monospace;">

<br style="font-family: courier new,monospace;">