The documentation states very clear that 
IntSet<http://docs.julialang.org/en/latest/stdlib/base/#Base.IntSet> should 
only be used for dense collections, and that 
Set<http://docs.julialang.org/en/latest/stdlib/base/#Base.Set>, 
should be used for sparse collections.

Construct a sorted set of the integers generated by the given iterable 
> object, or an empty set. Implemented as a bit string, and therefore 
> designed for dense integer sets. If the set will be sparse (for example 
> holding a single very large integer), use Set instead.


Do you happen to know a nice limit to how much memory IntSet should be 
allowed to use?

On my laptop 100 MB would be more than I can afford, but that would make 
IntSet unusable for bigger calculations on bigger systems, so it should be 
no smaller than 10 GB.

Ivar

kl. 15:16:33 UTC+1 fredag 28. februar 2014 skrev David P. Sanders følgende:
>
>
> I am investigating possible data structures for an application.
> Here is an "interesting" behaviour in IntSet, which is no doubt to do with 
> the implementation.
> Maybe it should just throw an exception if someone tries to add a really 
> large integer like this!
>
>
> julia> s = IntSet()
> IntSet()
>
> julia> push!(s, 100000)
> IntSet(100000)
>
> julia> sizeof(s)
> 24
>
> julia> push!(s, 1000000)
> IntSet(100000, 1000000)
>
> julia> sizeof(s)
> 24
>
> julia> push!(s, 10000000)
> IntSet(100000, 1000000, 10000000)
>
> julia> push!(s, 100000000)
> IntSet(100000, 1000000, 10000000, 100000000)
>
> julia> push!(s, 1000000000)
> IntSet(100000, 1000000, 10000000, 100000000, 1000000000)
>
> julia> sizeof(s)
> 24
>
> julia> push!(s, 10000000000)
> IntSet(100000, 1000000, 10000000, 100000000, 1000000000, 1410065408, 
> 1410065408, 1410065408, 1410065408, 1410065408, 1410065408, 1410065408, 
> 1410065408, 1410065408, 1410065408, 1410065408, 1410065408, 1410065408, 
> 1410065408, 1410065408, 1410065408, 1410065408^CEvaluation succeeded, but 
> an error occurred while showing value of type IntSet:
> ERROR: interrupt
>  in show at intset.jl:172
>  in anonymous at show.jl:973
>  in showlimited at show.jl:972
>  in writemime at repl.jl:2
>  in display at multimedia.jl:117
>  in display at multimedia.jl:119
>  in display at multimedia.jl:151
>

Reply via email to