[Issue 18627] std.complex is a lot slower than builtin complex types at number crunching

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Mar 20 06:18:10 UTC 2018


https://issues.dlang.org/show_bug.cgi?id=18627

Iain Buclaw <ibuclaw at gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ibuclaw at gdcproject.org

--- Comment #3 from Iain Buclaw <ibuclaw at gdcproject.org> ---
FYI, GDC is missing, but I'll post it anyway, along with DMD as a comparative
benchmark, because each machine is different and DMD may optimize weirdly for
one CPU but is perfectly fine for another (see for instance issue 5100)


DMD64 D Compiler v2.076.1
---
$ dmd complex.d -O -inline -release
With cfloat: 75 ms, 688 μs, and 2 hnsecs
With cdouble: 61 ms, 546 μs, and 7 hnsecs
With Complex!float: 161 ms, 816 μs, and 8 hnsecs
With Complex!double: 109 ms, 66 μs, and 1 hnsec
---

There seems to be room for improvement in dmd or the general phobos
implementation.


gdc (GCC) 8.0.1 20180226 (2.076.1 library and patches)
---
$ gdc complex.d -O2 -frelease
With cfloat: 154 ms, 871 μs, and 8 hnsecs
With cdouble: 59 ms, 205 μs, and 7 hnsecs
With Complex!float: 32 ms, 566 μs, and 5 hnsecs
With Complex!double: 34 ms, 961 μs, and 6 hnsecs
---

However with gdc, std.complex is /faster/ than native.

--


More information about the Digitalmars-d-bugs mailing list