-
Notifications
You must be signed in to change notification settings - Fork 607
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix slowdown in throttle due to improper use of stepLeg #2839
Conversation
Co-authored-by: Diego E. Alonso Blas <[email protected]>
@mpilquist It may help to add in the commit message, amended, a note about what was causing the slowdown in the old code that is not causing it in the new one. Was it an allocation and retention of not strictly necessary objects? Was this allocation growing over time running the throttle? Do we have any way of measuring or testing for slow-downs, just as we have for memory leaks? For instance, if the cause of the slowdown was a growing number of objects being allocated and retained , would running a |
I'm not sure actually. The problem was caused by converting the fs2/core/shared/src/main/scala/fs2/Stream.scala Lines 4837 to 4843 in 3f40b8c
I didn't work through exactly what was accumulating though. We don't currently have a way to measure for this type of slowdown. |
Is there a snippet that we may try running with |
Ha, whoops! It was reported on discord. I updated the description of this PR. |
Here's my original snippet that I shared with Michael and I first discussed on discord: https://scastie.scala-lang.org/mn98/oNhMT2wZR0O42S6lN0lUMQ/11 |
I have tried locally the given snippet. On the |
See this Scastie, provided on Discord: https://scastie.scala-lang.org/mn98/oNhMT2wZR0O42S6lN0lUMQ/8
https://discord.com/channels/632277896739946517/632310980449402880/950382134110081084
When the tick resolution argument of
throttle
is 100 millis, the output occurs at the correct speed. When the tick resolution is changed to 10 millis, the outputs get progressively slower.