TaskSet's `_task_queue` should be a `collections.deque`?
Prerequisites
- [X] I am using the latest version of Locust
- [X] I am suggesting a new feature, not asking a question
Description
While examining the source code to prepare the PR for #2651, I noticed that the TaskSet attribute _task_queue is a list, however insert/remove operations are performed both at the beginning and at the end.
Python has a dedicated deque for such operations, in particular:
Deques support thread-safe, memory efficient appends and pops from either side of the deque with approximately the same O(1) performance in either direction. Though list objects support similar operations, they are optimized for fast fixed-length operations and incur O(n) memory movement costs for pop(0) and insert(0, v) operations which change both the size and position of the underlying data representation.
Should this be changed?
I could implement the change in the same pull request.
That makes a ton of sense to me. PR:s welcome!
Fixed in #2698