perf improvements for threadpool