On Friday, 31 January 2014 at 10:39:19 UTC, Andrej Mitrovic wrote:
On 1/31/14, Stanislav Blinov <[email protected]> wrote:
You forgot to make the flag static for AtomicSingleton.

Ah. It was copied verbatim from reddit, I guess we both missed it.

Yeah, with D's verbosity in this cases it's easy to miss.

Here's mine:

$ dmd -release -inline -O -noboundscheck -unittest -run singleton.d

Test time for LockSingleton: 577.5 msecs.
Test time for SyncSingleton: 9.25 msecs.
Test time for AtomicSingleton: 159.75 msecs.

Maybe ldc's optimizer is just much better at this?

It is :) http://forum.dlang.org/thread/[email protected]

In either case how come the atomic version is slower?

It may not be universally true, as Dmitry mentioned. On some platforms, TLS could be slow but atomics fast. I'm suspecting that on Windows TLS could be slower, actually.

Reply via email to