std.algorithm.sort slower than C++'s std::sort for integer arrays
Jon Degenhardt
jond at noreply.com
Fri Nov 9 00:31:32 UTC 2018
On Thursday, 8 November 2018 at 14:36:45 UTC, Atila Neves wrote:
> This I was not expecting:
>
> https://www.reddit.com/r/programming/comments/9v8ouc/an_overview_of_sorting_algorithms_and_a_pretty/e9ajt1o/
I didn't see a build line. Assuming LDC, one thing that can
happen is that code from druntime/phobos may not be optimized as
well as code passed in on the build line (ie. manual.d) unless
LTO against druntime and phobos is used. Using LTO to include
druntime/phobos can be done by including:
-flto=<thin|full> -defaultlib=druntime-ldc-lto,phobos2-ldc-lto
on the build line. (Personally I'd start with 'thin' LTO and
switch to 'full' only if there's an issue.)
Using LTO on only D could result in a comparison inequity.
However, it is legitimate for comparing std.algorithm.sort to
manual.d.
--Jon
More information about the Digitalmars-d
mailing list