-
-
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
Improve invariants and performance in Chain #3533
Conversation
I also avoid writing |
Codecov Report
@@ Coverage Diff @@
## master #3533 +/- ##
==========================================
- Coverage 91.32% 91.12% -0.21%
==========================================
Files 386 386
Lines 8592 8989 +397
Branches 269 272 +3
==========================================
+ Hits 7847 8191 +344
- Misses 745 798 +53 |
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 is really cool, thanks!
While looking at this I found a performance improvement by not using an internal ArrayBuffer of 16% for large Chains. This is for iterator, which is used broadly. foldLeft exercises iterator.
@LukaJCB can you look again? |
@barambani could you take another look (merged with master, a few minor cleanups). |
LGTM on green. I think the failures are due to the update to scala 2.13.3. There are few missing parentheses on 'next' calls that now makes the build fail. |
Thanks @barambani I think I fixed it. Sorry for so many revisions here. :/ one more 👍 |
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.
Oh don't say it. It' my pleasure looking at your PRs.
I realized that if we keep a suptype of Chain to note that items are non-empty, we can (at no cost, I think) simplify the code and make it safer.
There is a minor bit of ugliness in Append because to make it binary compatible, we need to put back some methods that were there before. I went ahead and did this to satisfy mima even though these classes are private to data.
Side note: unless we really need to expose classes like this, I'm a big fan of keeping them totally private.
also is a possible replacement for #3373