takeaway: High-performance task queues
takeaway is a Rust library providing a high-performance, work-stealing task
queue data structure. It is perfect for task architectures where:
- There may be thousands of tasks ready to run at any time.
- Tasks are small, synchronous, and CPU-bound.
- All available CPUs should be used to maximum capacity.
- (Optional) Some tasks have a higher priority than others.
- (Optional) Grouping certain tasks lets them be executed efficiently.
takeaway tries to provide the lowest overhead possible. Its most important
optimization is to make theft very easy; every worker thread sets aside some
tasks to be stolen, putting them in a global buffer. Those tasks can be stolen
with a few atomic operations. Other costs (e.g. contention and sorting) are
largely amortized away by processing tasks in batches.
takeaway was developed for krabby, an experimental Rust compiler, due to
the limitations of crossbeam-deque (in particular, its overhead and the lack
of task prioritization functionality). It is offered as a separate crate in the
hope that others may find it useful for parallelized CPU-intensive applications.
License
Copyright (C) 2025 arya dradjica (uhe8ob7m71igsl1d@bal-e.org)
takeaway is available under the MIT or Apache-2.0 licenses, at your option.
Their terms are available in LICENSES/MIT.txt and LICENSES/Apache-2.0.txt
respectively.