LLVM and TLS
    Dan Olson via digitalmars-d-ldc 
    digitalmars-d-ldc at puremagic.com
       
    Wed Feb 18 09:03:37 PST 2015
    
    
  
"Jonathan Marler" <johnnymarler at gmail.com> writes:
> I've created a simple program to demonstrate the issue.  The
> performance cost of TLS vs __gshared is over one and a half orders of
> magnitude!
>
--snip--
I ran on my MacBook to compare DMD and LDC 2.066.1 versions.  With LDC,
I had to put in an emty asm instruction in the for loops otherwise the
optimizer removed all but the last write and timing looked really good
(0 milliseconds)!
LDC  __gshared versus TLS time is a bit better than DMD.
$ dmd -O timetls.d 
$ ./timetls 
--------------------------------------------------
run 1 (loopcount 10000000)
  TLS   : 93 milliseconds
  Shared: 6 milliseconds
run 2 (loopcount 10000000)
  TLS   : 91 milliseconds
  Shared: 6 milliseconds
run 3 (loopcount 10000000)
  TLS   : 92 milliseconds
  Shared: 4 milliseconds
$ ldmd2 -O3 timetls.d 
$ ./timetls 
--------------------------------------------------
run 1 (loopcount 10000000)
  TLS   : 21 milliseconds
  Shared: 3 milliseconds
run 2 (loopcount 10000000)
  TLS   : 22 milliseconds
  Shared: 5 milliseconds
run 3 (loopcount 10000000)
  TLS   : 20 milliseconds
  Shared: 3 milliseconds
    
    
More information about the digitalmars-d-ldc
mailing list