Testing some singleton implementations
Stanislav Blinov
stanislav.blinov at gmail.com
Fri Jan 31 01:18:17 PST 2014
You forgot to make the flag static for AtomicSingleton. I'd also
move the timing into the threads themselves, for fairness :)
http://codepad.org/gvm3A88k
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.
dmd -unittest -release -O -inline:
Test time for LockSingleton: 451.5 msecs.
Test time for SyncSingleton: 7.75 msecs.
Test time for AtomicSingleton: 99.75 msecs.
More information about the Digitalmars-d
mailing list