Because your question on SO I think you probably want to have array with 2 billion elements. And that you like some concrete problem to solve.
I am just curious. If you cannot use something like
array(n) = n instead of
array = [1:2^31...] then you probably need to change these values.
But are you planning shrinking this array with
deleteat! or something similar?
Maybe you could set array by init values:
array = zeros(2^31) (which has to be quick) and use something like
getvalue(index) = array[index] == 0 ? index : array[index] if you don’t need to look at values too often.
Don’t you want describe your problem in gist or blog (or here if it is not too long) to help us understand what to optimize?