optional thread_local optimization, WIP