fs2
fs2 copied to clipboard
Update evalTapChunk
Fixes #3351.
Benchmark: https://gist.github.com/kamilkloch/7edfe8cab15ebf0a75332c40b316ad18
This looks similar to @diesalbla's https://github.com/typelevel/fs2/pull/3197.
This looks similar to @diesalbla's #3197.
We have a benchmark here :)
It's similar, but @kamilkloch commit is more focused.
@kamilkloch I remembered that the evalMap
could not be directly written to an unconsFlatMap
. There are some differences between the flatMap
and the unconsFlatMap
, related to how the latter treats interruption.
In the PR I had, the code I was using was this:
underlying.unconsFlatMap(Pull.output1).scoped.flatMapOutput(onChunk).streamNoScope
This is more complicated, but needed to preserve that semantics. Could you try using that line on your PR and see if the benchmarks still show it worth it, please?
underlying.unconsFlatMap(Pull.output1).scoped.flatMapOutput(onChunk).streamNoScope
Does it compile? I get stuck at .scoped
.
There are some differences between the
flatMap
and theunconsFlatMap
, related to how the latter treats interruption.
Can we add a test for evalTapChunk
covering this case? It's clearly subtle and easy to make a regression.
Can we add a test for
evalTapChunk
covering this case? It's clearly subtle and easy to make a regression.
By all means, but I am afraid I would need some rope here (scopes are still an urchartered territory for me). @diesalbla, would you perhaps have and idea for a test?