I suggest first
julia> b = Set(["A"]) Set(ASCIIString["A"]) julia> first(b) "A"
We can talk about this by looking at the number of distributions. (since memory allocation is slow). I would ignore the actual time, as this is one run. The results shown are the second run of each call. with b declared const .
julia> @time first(b) 0.000003 seconds (4 allocations: 160 bytes) "A" julia> @time collect(b)[1] 0.000005 seconds (5 allocations: 240 bytes) "A" julia> @time first(next(b,start(b))) 0.000007 seconds (5 allocations: 192 bytes) "A"
source share