-
Notifications
You must be signed in to change notification settings - Fork 49
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
Reduce stack consumption #95
Conversation
3e321a0
to
92d9c7e
Compare
Codecov Report
@@ Coverage Diff @@
## master #95 +/- ##
==========================================
+ Coverage 77.1% 77.59% +0.49%
==========================================
Files 10 10
Lines 249 250 +1
Branches 2 2
==========================================
+ Hits 192 194 +2
+ Misses 57 56 -1
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💚
This looks great, looks like codecov says it decreased in 3% though and bumps it below 80% which we may want to address if it's something we can do as part of this PR. This improvements deserves a new release 👏 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The stack safety changes look great 👍 , but it seems that we have lost a few of our tests while splitting them in multiple files?
.map((x) => (0 until 2).toList.traverse(fetchBatchedDataSeq)) | ||
.foldLeft( | ||
Fetch.pure(List.empty[Int]) | ||
)((acc, f) => acc.flatMap((x) => f)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This foldLeft
with pure
and flatMap
could also be written using the monadic fold (Foldable#foldM
).
Something like (might need some type annotations):
import cats.instances.list._
import cats.syntax.foldable._
.foldM(List.empty[Int])((_, f) => f)
// or using foldMapM (this does combine all the lists though)
.foldMapM(identity)
} | ||
} | ||
|
||
class FetchTests extends AsyncFreeSpec with Matchers { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have we dropped these ?
Seems we are removing around 550 lines in this PR, which is more or less the same as these tests ?
@peterneyens i added the lost tests back and changed the |
Tried some extreme cases and found a couple of parts in the code where we could reduce stack consumption. Unfortunately the tests are failing due to a timeout in Travis CI, looking into it right now.