LLVM and TLS
Joakim via digitalmars-d-ldc
digitalmars-d-ldc at puremagic.com
Tue Feb 17 01:22:50 PST 2015
On Tuesday, 17 February 2015 at 02:41:12 UTC, Jonathan Marler
wrote:
> I've noticed that on my windows 7 development machine,
> switching between TLS and non-TLS storage has a minimal impact
> on performance (when using DMD). I haven't tried LDC yet,
> however, on a macbook pro, which uses clang (LLVM) for the
> linker, using TLS has a huge performance impact (much much
> slower). Does anyone know if this is because of the way LLVM
> handles TLS storage? I'll have to try using LDC on my windows
> machine but maybe one of you know off hand whether or not LLVM
> has some performance problems with TLS storage. Thanks!
It has little to do with the linker or llvm. dmd doesn't use the
native TLS APIs on OS X, as Dan says, because OS X didn't have
native TLS back then:
http://www.drdobbs.com/architecture-and-design/implementing-thread-local-storage-on-os/228701185
Druntime has since been updated to call pthread_setspecific and
pthread_getspecific, but maybe that's still slower than non-TLS
on OS X:
https://github.com/D-Programming-Language/druntime/blob/master/src/rt/sections_osx.d#L151
As Dan noted, David got ldc working with the since-added
undocumented TLS, ie TLV, functions on OS X:
https://github.com/ldc-developers/druntime/blob/ldc/src/ldc/osx_tls.c
On Tuesday, 17 February 2015 at 06:47:12 UTC, Martin Nowak wrote:
> On Tuesday, 17 February 2015 at 06:16:04 UTC, Dan Olson wrote:
>> Try LDC and see if the performance improves because LDC uses
>> OS X native TLS.
>
> Is there more information available abput OSX' TLS support and
> how this is implemented in LDX? What version of OSX is
> required? I'd very much like to use that for DMD/druntime too,
> so that we can go on with the shared library support.
The functions David used were added in 10.7.
More information about the digitalmars-d-ldc
mailing list