On Sunday, 26 March 2023 at 19:08:32 UTC, Steven Schveighoffer
wrote:
On 3/26/23 2:07 PM, ryuukk_ wrote:
Hi,
It's common knowledge that accessing tls global is slow
http://david-grs.github.io/tls_performance_overhead_cost_linux/
What i do not understand is the reasoning behind choosing tls
global by default in D
If you know a variable is not `shared`, then you know it can
only be accessed from the current thread. This has huge
implications for thread access.
However, one problem that D has no good solution is passing
thread-local data to another thread (to be owned by the new
thread, and no access in the current thread). That's typically
the most common use case for "shared data".
-Steve
I haven't explored this use case, that must explain why i find it
surprising, however, i read about other languages too, and they
seem to be explicit whenever they make use of TLS
C, C++, Rust, Zig, Go doesn't do TLS by default for example