What version of Julia are you using? In current Julia, Array(Nothing,n)
actually takes up no storage and returns instantly no matter how large n is:

julia> @time a = Array(Nothing, typemax(Int))
elapsed time: 3.645e-6 seconds (112 bytes allocated)
9223372036854775807-element Array{Nothing,1}:
 nothing
 nothing
 nothing
 ⋮
 nothing
 nothing
 nothing



On Mon, May 19, 2014 at 10:54 PM, David Einstein <[email protected]> wrote:

> When looking at  the speed of the maximal_cliques algorithm it appears
> that Sets are extremely slow, more than an order of magnitude slower than
> Python.  Some of this can be attributed to the fact that intersect copies
> the first set and then removes the elements that don't belong, instead of
> just adding the elements that occur in all sets.  If we fix that, things
> are still slow, and if I can trust the profiler it appears that an
> inordinate amount of time is being spent creating the value array either in
> the constructor or in empty!.
>
> I'm not sure what Array(Nothing, n) does, but it seems to take 10 times as
> long as Array(Int64, n).  Is there a simple way to make this fast, or would
> it be worth the trouble to make a special Set type by cloning Dict and
> removing all the value code.
>

Reply via email to