-
Notifications
You must be signed in to change notification settings - Fork 531
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 implicit search times for Filter, FilterNot, Union, Intersection #682
Improve implicit search times for Filter, FilterNot, Union, Intersection #682
Conversation
Current coverage is 81.35% (diff: 71.42%)@@ master #682 diff @@
==========================================
Files 69 69
Lines 2641 2655 +14
Methods 2375 2392 +17
Messages 0 0
Branches 92 89 -3
==========================================
+ Hits 2154 2160 +6
- Misses 487 495 +8
Partials 0 0
|
Can you add tests which explicitly invoke the now redundant methods? |
Sure, I will take a look at that. |
Hi — I could use guidance on two issues:
|
The old methods won't appear explicitly in any normal user code because they're intended to be invoked implicitly. That being so I think it's right to leave them undeprecated. A couple of thoughts. Can you get the same improvements for Also could you benchmark this change against leaving things as they are but compiling with Typelevel Scala 2.12.1 with the |
We could probably flip things around so that
|
On (1) yes, agreed. On (2), my intuitions are that if your rework of On (3) I think it makes sense to do this whether or not |
So on (1), would you prefer to (1a) not include the deprecated methods in tests, and ignore the codecov result, (1b) allow deprecated methods in tests by removing On (2), I can get it to two implementations, rather than three, but not down to one. With respect to Finally, I think I will move the simpler Thanks for reading this far ;-) |
(1c) ... thanks :-) |
I don't think #795 is any faster. I hadn't realized |
@aryairani it's been long time. Sorry about that. We are finally looking at a 2.4.0 release soon and I think this would be an important part of it. But the PR needs a rebase to resolve conflicts. |
actually might make sense to check scala 2.12.10 / 2.13.1 first |
I"m assuming we're no longer worried about bincompat for the purposes of this PR (due to the major version update)? I see some of the surrounding methods have already seen their signatures changed. |
Yes, that's right we are breaking bincompat for 2.4.0 |
0006ac9
to
6985c2d
Compare
Okay, I cleaned it up a bit. |
@aryairani thanks for coming back to this. Do you have the original code you used to test the performance? I want to try with newer versions of Scala to see if the performance gains are as dramatic as before. |
@joroKr21 Sorry for the delay — That's a bit tough 3 years later. 😅 I don't seem to have code immediately accessible, i.e. haven't found it in Dropbox. The computer I authored it and ran it on is currently in storage, so I can't easily check it. I may have a backup of said machine in the house, on an external backup appliance that's currently boxed up in the basement. How badly do we want that original code? Inventing something from scratch might be easier. WDYT? |
Ah, don't go through so much trouble. will try something from scratch. |
@aryairani I finally found time to try out the performance. Tried with an type B = Boolean
type I = Int
type L =
B :: I :: B :: I :: B :: I :: B :: I :: B :: I ::
B :: I :: B :: I :: B :: I :: B :: I :: B :: I ::
B :: I :: B :: I :: B :: I :: B :: I :: B :: I ::
B :: I :: B :: I :: B :: I :: B :: I :: B :: I ::
B :: I :: B :: I :: B :: I :: B :: I :: B :: I ::
B :: I :: B :: I :: B :: I :: B :: I :: B :: I ::
B :: I :: B :: I :: B :: I :: B :: I :: B :: I ::
B :: I :: B :: I :: B :: I :: B :: I :: B :: I ::
B :: I :: B :: I :: B :: I :: B :: I :: B :: I ::
B :: I :: B :: I :: B :: I :: B :: I :: B :: I ::
HNil
Partition[L, I] I think we can optimise
implicit def hlistPartition2[H, L <: HList, U, LPrefix <: HList, LSuffix <: HList](
implicit e: U =:!= H, p: Aux[L, U, LPrefix, LSuffix]
): Aux[H :: L, U, LPrefix, H :: LSuffix]
implicit def hlistPartition2[H, L <: HList, U, LPrefix <: HList, LSuffix <: HList](
implicit p: Aux[L, U, LPrefix, LSuffix], e: U =:!= H
): Aux[H :: L, U, LPrefix, H :: LSuffix] |
Do you have time to make that change? |
Putting the negation condition first improves dramatically.
cffd7f4
to
683b1ee
Compare
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.
Added a commit to optimise Partition
instead.
So wait, then is there no performance difference between the new I missed a comparison in #682 (comment). |
Maybe there is a small difference but nothing noticeable (i.e. all are linear now). |
Okay, great. |
Hi,
This patch provides a much faster implementation of
Filter
andFilterNot
, and somewhat faster implementations ofUnion
andIntersection
. (Without the patch, my compile times have been prohibitively slow, such that I can only use the static checks for very small operations.)(Note the log-lin scale.)
Codecov check fails only because newly-deprecated code (retained only for bincompat) is no longer used by tests. The non-covered code can be be deleted at the next minor release.