Testing some singleton implementations

Jonathan Bettencourt jbetten at gmail.com
Wed Feb 5 08:00:18 PST 2014


On Wednesday, 5 February 2014 at 09:30:51 UTC, Stanislav Blinov 
wrote:
> On Wednesday, 5 February 2014 at 08:39:08 UTC, Andrej Mitrovic 
> wrote:
>
>> No difference, but maybe the timing precision isn't proper. It 
>> always displays one of 3/3.25/4 msecs.
>
> Hmm... It should be as proper as it gets, judging from 
> StopWatch's docs.
>
>> Anywho what's important is that Atomic is really speedy and 
>> Sync is almost as fast. Except with DMD  which is
>> bad at optimizing this specific code.
>
> Yup, at least we have two fast low-lock implementations to 
> choose from depending on platform's capabilities regarding TLS 
> and atomics.

The atomics implementation in druntime is very inefficient, it 
uses compare-and-swap for nearly everything.

I'm working on a rewrite.


More information about the Digitalmars-d mailing list