一句话:通过消除 connect 操作的互递归,从规约推导出三续延编码,并推广至双向管道,在基准测试中媲美主流 Haskell 流处理库。
三续延方法能高效表示大量相连的协程组件,但此前工作未阐明如何从规约推导该编码。本文通过消除 connect 操作定义中的互递归,重新推导出三续延编码,揭示了其内在原理。利用相同的推导步骤,作者为更一般的双向管道场景导出了类似编码。在广告分析基准测试中,该编码的性能与 pipes、conduit 和 streamly 等常见 Haskell 流处理库相当。本文不仅提供了理论推导,还通过实验验证了编码的高效性。
Abstract The three-continuation approach to coroutine pipelines efficiently represents a large number of connected components. Previous work in this area introduces this alternative encoding but does not shed much light on the underlying principles for deriving this encoding from its specification. This paper gives this missing insight by deriving the three-continuation encoding based on eliminating the mutual recursion in the definition of the connect operation. Using the same derivation steps, we are able to derive a similar encoding for a more general setting, namely bidirectional pipes. Additionally, we evaluate the encoding in an advertisement analytics benchmark where it is as performant as pipes , conduit , and streamly , which are other common Haskell stream processing libraries.