Why is thread local storage so slow?
The speed depends on the TLS implementation. Yes, you are correct that TLS can be as fast as a pointer lookup. It can even be faster on systems with a memory management unit. For the pointer lookup you need help from the scheduler though. The scheduler must – on a task switch – update the … Read more