-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
add few missing methods for set-like operations #23528
Conversation
I now added mutating operations also for
I harmonized the behaviors in favor of the first, which is the most natural to implement, and the more general as it's possible to call |
Someone against this new behavior? I will otherwise implement the deprecations for the breaking parts. |
Does the increased generality of non-uniquing operations apply in all cases though, and argue for vector |
Very good remark! it could be true, but I guess that in order to implement these semantics efficiently, it would necessitate to implement a real So in short, what I did come up with is the most pragmatic solution I could find: treating vectors as sets as much as possible, while keeping consistency (when possible) with operations on real sets, and if possible keeping the implementation straightforward (if the implementation has to become too complex for those functionalities, it may be a sign that it belongs to a package). But there may be a better compromise. EDIT: BTW, the master's version of |
Sounds good but doesn't need to be on the milestone I think? |
It's a breaking change for |
Also, if we make this change: do we first deprecate the relevant methods in 0.7 and re-introduce the new in 1.0, or do we directly make the breaking change with a NEWS.md item? (I favor the latter) |
I think we can directly make the change with a news item. Seems unlikely to cause that much trouble. (Famous last words) |
From triage, please do rebase this and merge once CI passes. |
I can't run benchmarks here yet (BaseBenchmarks PR not merged yet), but if I remember correctly, this was also giving nice performance improvements! |
ca4bdf2
to
a74110c
Compare
@nanosoldier |
After 4 months, I'm finally able to run Nanosoldier :)
Let's see if I missed something. Should be good to go otherwise. |
a74110c
to
6bf6973
Compare
@nanosoldier |
1 similar comment
@nanosoldier |
Your benchmark job has completed - possible performance regressions were detected. A full report can be found here. cc @ararslan |
Some of those slowdowns are pretty large – it sounds like that might be correct and expected. If so, please go for it, but I'll let you judge if they're expected or not, @rfourquet. |
So no bad surprise, all those slowdowns are expected. Besides the no-op case, only intersect on a So let's not let this shadow all the other amazing perf improvements from this benchmark report and enjoy the new extended functionality! |
Excellent. Thank you! |
For
intersect
,union
,setdiff
andsymdiff
, and their mutating variants forSet
andIntSet
, there is now support for arbitrary many arguments consistently. What breaks is for one-argument versions: for example we hads=Set(); union(s) !== s
butsymdiff(s) === s
. I chose here to always return a copy (this should be the only regression in terms of performance). Also, I realize that havingsetdiff
accepting more or less than two arguments may be controversial; I find it natural, but can remove this bit if requested.This should not get merged until nanosoldier runs the corresponding benchmarks.
PS: nice to have those improvements with a net decrease of LOC! (in particular when there are 28 more lines for tests)
EDIT: also, this takes care of improving the complexity of some operations mentioned here.
EDIT: this also adds
filter
/filter!
forIntSet
returning anIntSet
(like forSet
andDict
).