Skip to content

Commit

Permalink
Merge pull request JuliaLang#26217 from JuliaLang/kf/bitsetperf
Browse files Browse the repository at this point in the history
Special case BitSet union! (fix performance)
  • Loading branch information
Keno committed Feb 27, 2018
2 parents d0723bf + c5b26db commit 6b5755c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions base/bitset.jl
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ very large integers), use [`Set`](@ref) instead.
"""
BitSet(itr) = union!(BitSet(), itr)

# Special implementation for BitSet, which lacks a fast `length` method.
union!(s::BitSet, itr) = foldl(push!, s, itr)

@inline intoffset(s::BitSet) = s.offset << 6

eltype(::Type{BitSet}) = Int
Expand Down

0 comments on commit 6b5755c

Please sign in to comment.