Here are some benchmarks of std.algorithm.sort vs. GCC 4.1.2&#39;s implementation of STL sort() and the implementation I use in my dstats library for lots of statistical calculations.<br><br>D code:<br>import std.stdio, std.perf, std.random, std.algorithm, dstats.sort;<br>
<br>void main(string[] args) {<br>    auto nums = new float[1_000_000];<br>    foreach(ref num; nums) {<br>        num = uniform(0.0, 10_000_000.0);<br>    }<br><br>    auto pc = new PerformanceCounter;<br>    pc.start;<br>
<br>    if(args.length &gt; 1 &amp;&amp; args[1] == &quot;--dstats&quot;) {<br>        dstats.sort.qsort(nums);<br>    } else {<br>        std.algorithm.sort(nums);<br>    }<br><br>    pc.stop;<br>    writeln(pc.milliseconds);<br>
}<br><br>C++ code:<br><br>#include &lt;vector&gt;<br>#include &lt;ctime&gt;<br>#include &lt;cstdlib&gt;<br>#include &lt;algorithm&gt;<br>#include &lt;iostream&gt;<br><br>using namespace std;<br><br>// Generates quick and dirty random numbers.<br>
float sloppyRand() {<br>    unsigned num = 0;<br>    num += (rand() &lt;&lt; 16);<br>    num += rand();<br>    return num;<br>}<br><br>int main() {<br>    vector&lt;float&gt; nums(1000000);<br>    for(int i = 0; i &lt; nums.size(); i++) {<br>
        nums[i] = sloppyRand();<br>    }<br><br>    double startTime = clock();<br>    sort(nums.begin(), nums.end());<br>    double stopTime = clock();<br><br>    double clocksPerMillisec = CLOCKS_PER_SEC / 1000.0;<br>    cout &lt;&lt; (stopTime - startTime) / clocksPerMillisec &lt;&lt; endl;<br>
}<br><br>Compilers:  <br>DMD 2.047 (for D)<br>GCC 4.1.2  (For C++;  I couldn&#39;t get the C++ code to compile on DMC because of STL issues that I don&#39;t feel like solving, even though this would level the playing field because D and C++ would have the same backend)<br>
<br>Results on Indel Xeon x5472:<br><br>Compiler settings:  -O -inline -release (for D), -O3 (for GCC)<br><br>D, using std.algorithm.sort:  330 milliseconds<br>D, using dstats.qsort:  96 milliseconds<br>C++, using 64-bit compile:  90 milliseconds<br>
C++, using 32-bit compile:  100 milliseconds<br><br>I&#39;d say std.algorithm.sort could use some serious optimization.<br>