In Apply.semigroup test replace ListWrapper with Option - #2827
Merged
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2827 +/- ##
=========================================
- Coverage 94.17% 93.87% -0.3%
=========================================
Files 368 368
Lines 6933 6955 +22
Branches 303 305 +2
=========================================
Hits 6529 6529
- Misses 404 426 +22
Continue to review full report at Codecov.
|
rossabaker
previously approved these changes
May 3, 2019
rossabaker
left a comment
Member
There was a problem hiding this comment.
Looks good, but see suggestion on scaladoc.
| * This semigroup uses a product operation to combine `F`s, | ||
| * if the `Apply[F].product` result in larger `F` e.g. when `F` is a `List`, | ||
| * accumulative usage of this instance, such as `combineAll`, will result in | ||
| * `F`s with exponentially increasing sizes. |
Member
There was a problem hiding this comment.
Light copy editing (spans lines, so I couldn't GitHub it):
* This semigroup uses a product operation to combine `F`s.
* If the `Apply[F].product` results in larger `F` (i.e. when `F` is a `List`),
* accumulative usage of this instance, such as `combineAll`, will result in
* `F`s with exponentially increasing sizes.
Contributor
|
Thanks for looking into that @kailuowang! |
LukaJCB
approved these changes
May 4, 2019
LukaJCB
left a comment
Member
There was a problem hiding this comment.
Thankfully we can eradicate one more source of flimsyness in the tests!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is to address the root cause of #2648 and #2319, the target method of this test is the combine method provided by
Apply.semigrouphttps://github.com/typelevel/cats/blob/master/core/src/main/scala/cats/Apply.scala#L223-L225
In the case of
Fbeing a list, since this is a product operation between the two lists, the result is a list of the sizea.size * b.sizeWhen this
combineis used in thecombineAllOptiontest, which combine all items in aVector[ListWrapper[Int]], it exponentially increase the size of the accumulative result list. That leads to a list of millions of items and over limit GC pressure that breaks the build.I switch it to using
Optioninstead.