use thread_local optimize maces codes