doc.go 1.2 KB

12345678910111213141516171819202122
  1. //go:generate go run gen.go
  2. // Package async provides unbounded channel and queue structures that are
  3. // designed for caching unlimited number of a concrete type. For better
  4. // performance, a given type should be less or euqal than 16 bytes.
  5. //
  6. // The difference of an unbounded channel or queue is that unbounde channels
  7. // can utilize select and channel semantics, whereas queue cannot. A user of
  8. // this package should balance this tradeoff. For instance, an unbounded
  9. // channel can provide zero waiting cost when trying to receiving an object
  10. // when the receiving select statement has a default case, and a queue can
  11. // only receive the object with a time amount of time, but depending on the
  12. // number of queue item producer, the receiving time may increase accordingly.
  13. //
  14. // Delicate dance: One must aware that an unbounded channel may lead to
  15. // OOM when the consuming speed of the buffer is lower than the producing
  16. // speed constantly. However, such a channel may be fairly used for event
  17. // delivering if the consumer of the channel consumes the incoming
  18. // forever, such as even processing.
  19. //
  20. // This package involves code generators, see gen.go for more details.
  21. package async