Skip to content

Repository files navigation

An experiment at building a faster ThreadPoolExecutor

Compared to concurrent.futures.ThreadPoolExecutor:

Better performance and efficiency:

  • Much less overhead per task. This means you can usefully parallelize more cases where there are many tasks and/or fast tasks.
  • Limit how many tasks are iterated over, even when buffersize is not used, reducing memory usage when lazy task creation is used.

Correctness:

  • contextvars context is propagated from the time a task is scheduled, rather than the thread pool creation. See this discussion for details.

More flexibility in API design:

  • map(func, *iterables, return_in_order=False) allows for results to be returned when finished, rather than in order. This can speed up execution slightly.

About

An experiment in building a faster ThreadPoolExecutor

Resources

Code of conduct

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages