[Issue 4244] AA insert from fixed-sized array much slower than from equivalent struct

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Tue Jun 30 11:28:45 PDT 2015


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

hsteoh at quickfur.ath.cx changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hsteoh at quickfur.ath.cx

--- Comment #1 from hsteoh at quickfur.ath.cx ---
Confirmed that this performance issue still happens on git HEAD
(1ceb899e9ee430bcd223ddeeb907245ea5be3d47). Tested on Linux/64bit, AMD Phenom
II X6 1055T (800 MHz).

The original code runs a little too fast on my system to have any measurable
performance numbers (S/N ratio too low to be accurate), so I bumped N to 1800,
and noted that the foo1() version takes on average about 1.4 to 1.5 seconds to
complete, whereas the foo2() version takes only about 0.8 to 0.9 seconds on
average. Both versions compiled with `dmd -O -release -inline`. (Surprisingly
enough, not specifying -inline seems to produce faster code?! It's a small
difference, though, so could just be background noise.)

Also surprisingly, gdc-5.1.1 produces much slower code than dmd in this case:
the foo1() version takes on average about 3.9 seconds, whereas the foo2()
version takes on average about 3.4 seconds. Both compiled with `gdc -O3
-finline -frelease`. This may possibly be caused by gdc using an older version
of druntime, as recently the AA code in git HEAD has had some performance
improvements.

Will take a look into the generated assembly code next.

--


More information about the Digitalmars-d-bugs mailing list