On Friday, 9 June 2017 at 21:11:50 UTC, Steven Schveighoffer
wrote:
Just to show you what I meant, I changed your code to eliminate
the functors completely, the main function now looks like this:
foreach (i; 0 .. N)
{
insertionSort!((a, b) => lt(a, b))(v);
insertionSort!((a, b) => lt(b, a))(v);
}
I'm sure there's also a way to reduce the initialization of the
array to a few lines (or maybe even one?), but didn't have time
to think about it.
Thanks for your hints. I'm sure there are many things to improve
(also in the C++ version). It should be pretty obvious that my
knowledge of D is lacking.
Well, D is pretty fast, as fast as C++ or C. What I mean is
that there is no inherent overhead -- both can produce exactly
the same code.
I agree.
However, there are some parts of C/C++ that have been optimized
to death. It's one of those things where D's version of rotate
probably hasn't had as much scrutiny as C++'s version. We are
always looking to improve such things, and more investigation
and suggestions are most welcome! It's why I filed the bug
report.
Thank you for filing the bug!
bringToFrontImpl does not seem to exploit bidirectional or random
access properties.
Try to find something besides insertion sort to test with I
think ;) D is pretty fast at a lot of things, and pleasant to
write. You just found one test case that isn't (and we will fix
it, I'm sure).
I guess that benchmarking comparison of string tuples will not
result in happy faces unless a single-pass version of the
comparison function is used.