In Perl_safesys{c,m,re}alloc(), defer dTHX for non-DEBUGING builds.
Under ithreads, dTHX expands to pthread_getspecific() [or something similarly
expensive], which the compiler can't optimise away. However, its return value
isn't needed unless the allocation fails. So defer the call, hence avoiding
it entirely on a successful allocation.
DEBUGING builds require the value of dTHX for debugging purposes, so we can't
postpone it for them. Unthreaded builds were never affected as they don't use
thread local storage for the interpreter context.