Testing some singleton implementations

luka8088 luka8088 at owave.net
Sun Feb 9 16:04:44 PST 2014


On 9.2.2014. 15:09, Stanislav Blinov wrote:
> On Sunday, 9 February 2014 at 12:20:54 UTC, luka8088 wrote:
> 
>> What about swapping function pointer so the check is done only once per
>> thread? (Thread is tldr so I am sorry if someone already suggested this)
> 
> That is an interesting idea indeed, though it seems to be faster only
> for dmd. I haven't studied the assembly yet, but with LDC I don't see
> any noticeable difference between SyncSingleton and
> FunctionPointerSingleton.

I got it while writing code for dynamic languages (especially
javascript). Thought came that instead of checking for something that
you know will always have the same result just remove that piece of code
and voila :)



More information about the Digitalmars-d mailing list