collectionsequalityhelp wantedperformance
Metriche repository
- Star
- (48.709 star)
- Metriche merge PR
- (Merge medio 20g 6h) (157 PR mergiate in 30 g)
Descrizione
Looking at the following benchmarks
issetequal is the equal slowest way to accomplish this
julia> data = shuffle(1:1000);
julia> @btime Set($data)==Set(1:1000);
41.753 μs (24 allocations: 91.92 KiB)
julia> @btime isempty(setdiff($data, 1:1000));
29.072 μs (15 allocations: 53.95 KiB)
julia> @btime (k = Set($data); length(k)==1000 && extrema(k) ==(1,1000))
18.206 μs (12 allocations: 45.96 KiB)
julia> @btime issetequal($data, 1:1000);
41.458 μs (24 allocations: 91.92 KiB)
It would be a nice PR to add some more overloads like that.
I suspect the extrema + length is good for all types that IteratorSize(T) = HasLength()