__thread / __declspec(thread) struct {..} thread_globals;
and accesing it in code by
thread_globals.variable
which probably relay on CPU's MMU (depends on compiler and libc) is probably faster than
(((type) (*((void ***) tsrm_ls))[TSRM_UNSHUFFLE_RSRC_ID(id)])->element)
If you compare these, no doubt the former will be slightly faster. But you won't be comparing these, as it will most probably not be practical to have different TLSs for shared objects, the number of TLSs is very limited, and at least under Windows, there are serious limitations with their use in the context of DLLs. This is what made us forget about it under Windows. Instead, the only thing you will be able to effectively use it for is one single TLS, as we already do today with TSRM. So essentially, you'd have to do something very similar to what we're doing today. The one field where this may save is the need to pass the context all over PHP, but it will most probably make no difference as far as fetches are concerned.
Another note to remember is that we heavily rely on just-in-time construction of such globals. It won't necessarily be easy to implement such a feature if we let the compiler do it.
signing off for the night,
Zeev
-- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php