-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Simplified traverse
method for vectors by using foldLeft
#2091
Conversation
By doing this, there's no need for the `Eval` wrapper and avoiding the `foldRight` which could potentially be more efficient
Codecov Report
@@ Coverage Diff @@
## master #2091 +/- ##
==========================================
- Coverage 94.63% 94.63% -0.01%
==========================================
Files 318 318
Lines 5391 5390 -1
Branches 209 210 +1
==========================================
- Hits 5102 5101 -1
Misses 289 289
Continue to review full report at Codecov.
|
Thanks for bringing this up, @amitayh. It could potentially be more efficient, but I actually thought that we had some tests that were checking that |
It looks like we have these tests for |
This adds a test case that the `traverse` implementation for `Vector` short-circuits the traversal when possible. This would have failed the build in typelevel#2091. See typelevel#1015 for when similar tests were added for similar structures.
Can we add benchmarks when we are making such trade offs? |
Is there some tool you're using for benchmarking? I can try to run a few tests... |
@amitayh there are some benchmarks in https://github.com/typelevel/cats/tree/master/bench/src/main/scala/cats/bench that would probably be a good starting point. |
By doing this, there's no need for the
Eval
wrapper and avoiding thefoldRight
which could potentially be more efficient