Sure - I was assuming that as Symbol (as an interned string) is basically just a pointer. So comparisons are O(1), etc. What I'd like to understand is, why can't it be a bitstype? Currently, it's not, so Symbol cannot be used in a lightweight (i.e. stack-allocated) immutable type. I assume there's a good reason for it, I just want to understand why.
On Tuesday, August 16, 2016 at 10:03:14 PM UTC+2, Cedric St-Jean wrote: > > Scott is right, storing/comparing/hashing symbols is probably all done on > the pointers, so it's as efficient as you can hope for. > > On Tuesday, August 16, 2016 at 11:44:46 AM UTC-4, Oliver Schulz wrote: >> >> Hi, >> >> I was thinking of using Symbols as keys in a Dict{Symbol,Int64}, instead >> of Strings. However, Symbol is not a bitstype, so there I guess there will >> still be a lot of individual memory allocation when working with such a >> Dict, right? >> >> Actually, why isn't Symbol a bitstype (according to >> https://github.com/JuliaLang/julia/issues/5880, symbols are not GCed)? >> >> >> Cheers, >> >> Oliver >> >>