improve performance of threadpool