The Packt book Julia 1.0 Programming Complete Reference Guide has an example on page 95 which I assumed was a misprint.
x = Set(collect(1:100)) @time 2 in x
0.003186 seconds …
x2 = Set(collect(1:1000000)) @time 2 in x2
0.000003 seconds …
I tried variations and the time for the larger set is less than the smaller set. It’s not a misprint. I assume they’re trying to say set size doesn’t make a difference, but WHY does the larger set keep outperforming the smaller set?
Checking set inclusion is O(1) so the the size of the set doesn’t really matter. Compilation time is included the first time you call the in function to check set inclusion. You generally want to use BenchmarkTools to measure timings.