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. > Timings on my machine: > > ldc2 -unittest -release -O3: > > Test time for LockSingleton: 537 msecs. > Test time for SyncSingleton: 2 msecs. > Test time for AtomicSingleton: 2.25 msecs. 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? In either case how come the atomic version is slower?
