Skip to content

Commit

Permalink
use empirically found threshold to speed up issubset by creating Set … (
Browse files Browse the repository at this point in the history
  • Loading branch information
twistedcubic authored and JeffBezanson committed Mar 7, 2018
1 parent 9e8cd03 commit 4acc345
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions base/abstractset.jl
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,16 @@ false
```
"""
function issubset(l, r)

rlen = length(r)
#This threshold was empirically determined by repeatedly
#sampling using these two methods.
lenthresh = 70

if rlen > lenthresh && !isa(r, AbstractSet)
return issubset(l, Set(r))
end

for elt in l
if !in(elt, r)
return false
Expand Down

0 comments on commit 4acc345

Please sign in to comment.