On 5 May 2014 19:07, Orvid King via Digitalmars-d <digitalmars-d@puremagic.com> wrote: > Going to take a wild guess, but as core.atomic.casImpl will never be > inlined anywhere with DMD, due to it's inline assembly, you have the > cost of building and destroying a stack frame, the cost of passing the > args in, moving them into registers, saving potentially trashed > registers, etc. every time it even attempts to acquire a lock, and the > GC uses a single global lock for just about everything. As you can > imagine, I suspect this is far from optimal, and, if I remember right, > GDC uses intrinsics for the atomic operations. >
Aye, and atomic intrinsics though they may be, it could even be improved by switching over to C++ atomic intrinsics, which map directly to core.atomics. :)