Testing some singleton implementations

Marco Leise Marco.Leise at gmx.de
Fri Feb 7 17:04:17 PST 2014


Am Wed, 05 Feb 2014 16:47:40 -0500
schrieb Jerry <jlquinn at optonline.net>:

> "Stanislav Blinov" <stanislav.blinov at gmail.com> writes:
> 
> > On Wednesday, 5 February 2014 at 00:11:58 UTC, Jerry wrote:
> >
> >> 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.
> >
> > Whoah, those times for AtomicSingleton are way high. What kind of machine is
> > your laptop?
> 
> Core 2 Due T9400.  The gdc times were much better for AtomicSingleton -
> about 4x slower than SyncSingleton.
> 
> > Perhaps we need to repost the test with the latest implementation of
> > AtomicSingleton.
> 
> I downloaded the test program yesterday.

I just tested with DMD 2.064.2 and my numbers for the
AtomicSingleton are not as high.
This is on a Core 2 Duo T7250 / 2.0 Ghz.

Test 0 time for SyncSingleton: 1068.83 msecs.
Test 0 time for AtomicSingleton: 2102.32 msecs.

Test 1 time for SyncSingleton: 901.215 msecs.
Test 1 time for AtomicSingleton: 2479.6 msecs.

Test 2 time for SyncSingleton: 1091.91 msecs.
Test 2 time for AtomicSingleton: 2269.45 msecs.

Test 3 time for SyncSingleton: 1156.74 msecs.
Test 3 time for AtomicSingleton: 2498.25 msecs.


Also for GDC my numbers are like this:

Test 0 time for SyncSingleton: 657.928 msecs.
Test 0 time for AtomicSingleton: 851.795 msecs.

Test 1 time for SyncSingleton: 655.204 msecs.
Test 1 time for AtomicSingleton: 893.51 msecs.

Test 2 time for SyncSingleton: 613.881 msecs.
Test 2 time for AtomicSingleton: 843.635 msecs.

Test 3 time for SyncSingleton: 657.87 msecs.
Test 3 time for AtomicSingleton: 709.823 msecs.

Which is far from the difference you see.

-- 
Marco



More information about the Digitalmars-d mailing list