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
{{ message }}
Repository navigation
Quadratic performance on left-associated binds #109
Firstly, before talking about a solution, do you actually consider this a bug? I do, and I think the risk of hitting unexpected quadratic performance makes this library unsuitable for production use as it is. On the other hand maybe you have a good reason that I shouldn't think that. If so I would be interested to hear it.
If you do think this is a bug then let's think about what can be done. I know of two straightforward options:
@tomjaguarpaw Here's another data point. While working on streamly, I experimented with changing streaming' s representation to be more like streamly's (and vector's) internal representation which can be found at streaming-fusion.
Here is that library added to the benchmark:
Edit:
Legend (from top-to-bottom):
Pipes
Streaming (orange)
List
Conduit & Streamly slightly overlapping, streamly is purple
Streaming codensity & streaming-fusion overlapping, streaming-fusion is black
While working on streamly, I experimented with changing streaming' s representation to be more like streamly's
Yup, makes sense that the performance is similar to streaming when I wrapped it with Codensity. I find it interesting that streaming with explicit binds is faster still!
The Bind implementation is nice, I changed the MonadTrans instance of streaming-fusion to be more like the streaming bind implementation and looks like it improves the performance quite a bit!!
Activity
harendra-kumar commentedon Oct 3, 2021
This paper https://rubenpieters.github.io/assets/papers/JFP20-pipes.pdf presents similar results, it has some more benchmarks as well. @tomjaguarpaw its nice to see that you have presented a solution as well. Looks neat.
pranaysashank commentedon Oct 3, 2021
@tomjaguarpaw Here's another data point. While working on streamly, I experimented with changing streaming' s representation to be more like streamly's (and vector's) internal representation which can be found at streaming-fusion.
Here is that library added to the benchmark:
Edit:
Legend (from top-to-bottom):
Edit 2: Also here's the modified benchmark https://github.com/pranaysashank/streaming-benchmark
Edit 3: Updated the image to reflect that conduit has no issue
treeowl commentedon Oct 3, 2021
@pranaysashank, I find the colors on that graph really hard to work out. Could you rearrange the key from top to bottom or something?
pranaysashank commentedon Oct 3, 2021
@treeowl I don't know enough about gnuplot to modify the generated image. So I just updated the comment with the keys top to bottom
tomjaguarpaw commentedon Oct 3, 2021
[N.B. conduit doesn't have quadratic performance. I made a mistake when setting up the benchmarks: tomjaguarpaw/streaming-benchmark@2a965a7]
tomjaguarpaw commentedon Oct 3, 2021
Yup, makes sense that the performance is similar to streaming when I wrapped it with
Codensity. I find it interesting that streaming with explicit binds is faster still!pranaysashank commentedon Oct 3, 2021
The Bind implementation is nice, I changed the MonadTrans instance of
streaming-fusionto be more like the streaming bind implementation and looks like it improves the performance quite a bit!!Here's the relevant commit: pranaysashank/streaming-fusion@9f56fe6
tomjaguarpaw commentedon Oct 3, 2021
@pranaysashank Wow! That's impressive.