Skip to content

Conversation

@anicolaspp
Copy link
Contributor

No description provided.

@codecov-io
Copy link

codecov-io commented Oct 29, 2019

Codecov Report

Merging #253 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #253      +/-   ##
==========================================
+ Coverage   91.23%   91.24%   +<.01%     
==========================================
  Files          24       24              
  Lines        1621     1622       +1     
  Branches      227      217      -10     
==========================================
+ Hits         1479     1480       +1     
  Misses        142      142
Impacted Files Coverage Δ
core/src/main/scala/cats/collections/Heap.scala 98.57% <100%> (+0.01%) ⬆️
core/src/main/scala/cats/collections/BitSet.scala 97.36% <0%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5da20c0...fb9a85e. Read the comment docs.


def toIterator(implicit order: Order[A]): Iterator[A] = {
@scala.annotation.tailrec
def build(heap: Heap[A], acc: Stream[A]): Stream[A] = heap match {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is using a Stream better than just building the List below? Since it is tailrec you are building the whole Stream no? If we do that, isn’t a List cheaper?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in list you have to reverse it at the end.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this particular case the following does not apply, but in the other implementations, the stream based removed the need for mutations, and adds stateless build of the iterator.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we are making a performance argument, can we show a win with benchmarks?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh man, you are killing me... I haven't written one of those in a while. Let me see

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants