← index #5828Issue #2219
Off-topic · high · value 1.222
QUERY · ISSUE

extmod/uasyncio: Queue is missing

openby tveopened 2020-03-28updated 2020-03-30

The new uasyncio doesn't have a Queue class (unless I'm getting blind?). That seems like a pretty core sync primitive. Should this be added or should that go into a separate library? There's also Condition, Semaphone and more... Where should such a library go or what is the plan?

CANDIDATE · ISSUE

RFC: Optimized heap queue implementation for uasyncio

closedby pfalconopened 2016-07-03updated 2016-11-11

Switch uasyncio to wrap-around time source like utime.ticks_ms(), as required for baremetal ports, requires changing to the comparison done in uheapq module - it should use partial ordering definable for modular arithmetic (ring math object). So, that requires changing uheapq anyway, and I currently have adhoc changes for that coded.

Besides this must-have feature, there're also change to optimize:

  1. Pre-allocate queue of some size.
  2. Avoid constant packing and unpacking of tuples as done now.

So, that actually calls for introduction of adhoc heap queue class implementation for uasyncio. The main question is how to implement it - I consider turning current moduheapq.c into header with poor-man's templating implementation to teach it working with different data structures. Any objections?

After this changes, there will be (in a common case) the only remaining source of memory traffic for uasyncio usage - constant generator creation from yield from.

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied