You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
Prerequisites
Description
While examining the source code to prepare the PR for #2651, I noticed that the
TaskSet
attribute_task_queue
is alist
, 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.
The text was updated successfully, but these errors were encountered: