Testing some singleton implementations

Jerry jlquinn at optonline.net
Tue Feb 4 16:11:58 PST 2014


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

> On Tuesday, 4 February 2014 at 09:44:04 UTC, Andrej Mitrovic wrote:
>
>> I've finally managed to build LDC2 on Windows (MinGW version), here
>> are the timings between DMD and LDC2:
>>
>> $ dmd -release -inline -O -noboundscheck -unittest singleton_2.d
>>  -oftest.exe && test.exe
>> Test time for LockSingleton: 606.5 msecs.
>> Test time for SyncSingleton: 7 msecs.
>> Test time for AtomicSingleton: 138 msecs.
>>
>> $ ldmd2 -release -inline -O -noboundscheck -unittest singleton_2.d
>>  -oftest.exe && test.exe
>> Test time for LockSingleton: 536.25 msecs.
>> Test time for SyncSingleton: 5 msecs.
>> Test time for AtomicSingleton: 3 msecs.
>>
>> Freaking awesome!

Here's the best and worst times I get on my linux laptop.  These are
with 2.064.2 dmd and gdc 4.9 with 2.064.2

On Ubuntu x86_64:

~/dmd2/linux/bin64/dmd -O -release -inline -noboundscheck -unittest singleton.d

Test 2 time for SyncSingleton: 753.547 msecs.
Test 2 time for AtomicSingleton: 22290.3 msecs.

Test 3 time for SyncSingleton: 254.968 msecs.
Test 3 time for AtomicSingleton: 22903.3 msecs.

Test 6 time for SyncSingleton: 510.118 msecs.
Test 6 time for AtomicSingleton: 23970.9 msecs.

Test 8 time for SyncSingleton: 480.175 msecs.
Test 8 time for AtomicSingleton: 12827.9 msecs.


../bin/gdc -frelease -funittest -O3 singleton.d

Test 0 time for SyncSingleton: 458.605 msecs.
Test 0 time for AtomicSingleton: 1985.87 msecs.

Test 1 time for SyncSingleton: 334.097 msecs.
Test 1 time for AtomicSingleton: 2030.29 msecs.

Test 5 time for SyncSingleton: 355.765 msecs.
Test 5 time for AtomicSingleton: 1040.87 msecs.


Test 9 time for SyncSingleton: 295.145 msecs.
Test 9 time for AtomicSingleton: 1272.22 msecs.


It seems like gdc and dmd are similar for SyncSingleton.
AtomicSingleton is significantly faster for gdc, but not as fast as
SyncSingleton.



More information about the Digitalmars-d mailing list