LLVM and TLS

Jonathan Marler via digitalmars-d-ldc digitalmars-d-ldc at puremagic.com
Wed Feb 18 12:05:57 PST 2015


On Wednesday, 18 February 2015 at 17:03:38 UTC, Dan Olson wrote:
> 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

That's quite a bit better.  If I run this using DMD on windows I 
get almost the same performance:

dmd test.d
--------------------------------------------------
run 1 (loopcount 10000000)
   TLS   : 28 milliseconds
   Shared: 25 milliseconds
run 2 (loopcount 10000000)
   TLS   : 28 milliseconds
   Shared: 25 milliseconds
run 3 (loopcount 10000000)
   TLS   : 27 milliseconds
   Shared: 25 milliseconds

If I turn on optimization they both take 7 milliseconds.



More information about the digitalmars-d-ldc mailing list