Skip to content
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

Override size in Chain instance #2425

Merged
merged 2 commits into from
Aug 20, 2018
Merged

Conversation

ceedubs
Copy link
Contributor

@ceedubs ceedubs commented Aug 19, 2018

This should be a slight optimization.

This should be a slight optimization.
@@ -538,6 +538,7 @@ private[data] sealed abstract class ChainInstances extends ChainInstances1 {
override def exists[A](fa: Chain[A])(p: A => Boolean): Boolean = fa.exists(p)
override def forall[A](fa: Chain[A])(p: A => Boolean): Boolean = fa.forall(p)
override def find[A](fa: Chain[A])(f: A => Boolean): Option[A] = fa.find(f)
override def size[A](fa: Chain[A]): Long = fa.length.toLong
Copy link
Member

Choose a reason for hiding this comment

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

fa.length already returns Long, so no need for the call to toLong :)

@ceedubs
Copy link
Contributor Author

ceedubs commented Aug 19, 2018 via email

Copy link
Contributor

@johnynek johnynek left a comment

Choose a reason for hiding this comment

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

Can we add benchmarks to provide evidence? @LukaJCB already started us out strong.

Copy link
Contributor

@johnynek johnynek left a comment

Choose a reason for hiding this comment

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

Although I guess here we are just delegating to the type specific version so never mind.

@codecov-io
Copy link

codecov-io commented Aug 19, 2018

Codecov Report

Merging #2425 into master will decrease coverage by 0.01%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2425      +/-   ##
==========================================
- Coverage   95.22%   95.21%   -0.02%     
==========================================
  Files         351      351              
  Lines        6368     6369       +1     
  Branches      279      281       +2     
==========================================
  Hits         6064     6064              
- Misses        304      305       +1
Impacted Files Coverage Δ
core/src/main/scala/cats/data/Chain.scala 97% <0%> (-0.42%) ⬇️

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 84e9641...45096e4. Read the comment docs.

@kailuowang kailuowang merged commit fe409cf into typelevel:master Aug 20, 2018
@LukaJCB LukaJCB added this to the 1.3 milestone Sep 2, 2018
catostrophe pushed a commit to catostrophe/cats that referenced this pull request Sep 15, 2018
* Override size in Chain instance

This should be a slight optimization.

* Update Chain.scala
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.

5 participants