From 4acc34540584a4f72ed54661ad866ce3f25360c5 Mon Sep 17 00:00:00 2001 From: Yihe Dong Date: Wed, 7 Mar 2018 12:12:06 -0600 Subject: [PATCH] =?UTF-8?q?use=20empirically=20found=20threshold=20to=20sp?= =?UTF-8?q?eed=20up=20issubset=20by=20creating=20Set=20=E2=80=A6=20(#26198?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- base/abstractset.jl | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/base/abstractset.jl b/base/abstractset.jl index 8291adf517922..2e81f258cb737 100644 --- a/base/abstractset.jl +++ b/base/abstractset.jl @@ -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