async-task
crate: It is one of the most complicated crates in thesmol
ecosystem and is just a future on the heap. It predatessmol
and was originally used as the task implementation forasync-std
.smol
package: The author prides himself on makingsmol
packages easy to parse for beginners.futures-lite
crate: Used to run two futures at the same time easily by using thezip
combinator andblock_on
.- Scalability solutions: The
zip
combinator has limitations for higher-level scenarios. Theslab
crate is used to fit futures and boxedFuture
to use multiple implementors. AGiantZip
struct is created to poll multiple futures at once. But it has problems like being inefficient and unfair. - Queue structure: A queue structure is added to the
GiantZip
to solve theO(n)
problem and the fairness problem. The queue contains the indexes of the futures that are ready to be woken. Thepoll
implementation is adjusted to pop from the queue instead of polling each future. - Persistent problems: There are inefficiencies in the current implementation like three main allocations (a
Vec
, aBox
for each future, and aWaker
). There are also issues like usingusize
as an index, not being able to get the result of a future, and difficulty in removing a running future. These problems will be addressed in the next blog post when building a real task abstraction.
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。