In julia 0.3, my module includes
const npop = 500 #population size
This takes a very noticeable (1 minute?) amount of time to compile.
If I set const npop=50 instead, compilation is instant (i.e., no
perceptible delay).
The module does create some Arrays that have npop as one of their
dimensions. Some are 500 x 40.
Is this behavior expected?
I might believe different code is generated when npop is very small, but
for 50 is already well over what I'd call small.
Ross Boylan
P.S. the module level variables involving npop are (with nstep=40,
n1=250)
counts = zeros(Int, 3, nstep)
affinity = randn(npop, npop) # will be modified later
x = [ i<=n1 ? 1 : 2 for i in 1:npop]
beta = [0.5 -0.5; -0.5 0.5]
for i = 1:npop, j=1:npop
affinity += beta[x[i], x[j]]
end
type Actor
cut :: Vector{FloatingPoint} # track cut point for each time
matches :: Matrix{Int} # 2xtime successful matches with each type
end
Actor() = Actor(2ones(FloatingPoint, nstep), zeros(Int, 2, nstep))
actors = Array(Actor, npop)
fill!(actors, Actor())
I also specify the random seed, and so in principle everything could be
set up at compile time.