Testing some singleton implementations

Jerry jlquinn at optonline.net
Thu Feb 6 20:06:40 PST 2014


"Stanislav Blinov" <stanislav.blinov at gmail.com> writes:

> On Wednesday, 5 February 2014 at 21:47:40 UTC, Jerry wrote:
>
>> I downloaded the test program yesterday.
>
> Here's my latest revision: http://dpaste.dzfl.pl/5b54df1c7004
>
> Andrej, I hope you don't mind me fiddling with that code? I've put that atomic
> fix in there, also switched timing to use hnsecs (converted back to msecs for
> output), which seems to give more accurate readings.

Yup, that helps out the AtomicSingleton a lot.  Here's best and worst
times for each for dmd and gdc:


jlquinn at wyvern:~/d/tests$ ~/dmd2/linux/bin64/dmd -O -release -inline -unittest singleton2.d 
jlquinn at wyvern:~/d/tests$ ./singleton2
*Test 2 time for SyncSingleton: 585.992 msecs.
Test 2 time for AtomicSingleton: 1189.03 msecs.

Test 5 time for SyncSingleton: 796.834 msecs.
*Test 5 time for AtomicSingleton: 1069.08 msecs.

*Test 7 time for SyncSingleton: 811.711 msecs.
Test 7 time for AtomicSingleton: 1263.36 msecs.

Test 9 time for SyncSingleton: 605.729 msecs.
*Test 9 time for AtomicSingleton: 2173.74 msecs.


jlquinn at wyvern:~/d/tests$ ../bin/gdc -O3 -finline -frelease -fno-bounds-check -funittest singleton2.d 
jlquinn at wyvern:~/d/tests$ ./a.out 
Test 0 time for SyncSingleton: 542.797 msecs.
*Test 0 time for AtomicSingleton: 257.805 msecs.

*Test 5 time for SyncSingleton: 620.052 msecs.
Test 5 time for AtomicSingleton: 248.951 msecs.

Test 7 time for SyncSingleton: 437.124 msecs.
*Test 7 time for AtomicSingleton: 605.781 msecs.

*Test 8 time for SyncSingleton: 252.643 msecs.
Test 8 time for AtomicSingleton: 279.854 msecs.



More information about the Digitalmars-d mailing list