I just started with Julia
I run with Julia 0.2.1 under Mac OSX 10.9.4 (Intel Core i7 with 8 GB @
1600MHz)
As a first try I decided to write a bit size bitmap module.
I am Using Uint (Uint 64 on my laptop)
I got some strange memory allocation value:
julia> bmv = zeros (Uint, 2^20)
1048576-element Array{Uint64,1}:
0x0000000000000000
0x0000000000000000
0x0000000000000000
...
*julia> *
*sizeof(bmv)*
*8388608**julia> *
*@time for i in 1:11:2^26*
* bmv[(i >>> 6) + 1] |= 1 << (i & 0x3F)** end*
elapsed time: 1.547175739 seconds (524573328 bytes allocated)
*julia> *
*@time for i in 1:11:2^26** bmv[(i >>> 6) + 1] |= 1 << (i &
0x3F)*
* end*
elapsed time: 1.563902069 seconds (571854576 bytes allocated)
*julia> **sizeof(bmv)*
*8388608*
*julia> **@time sum(count_ones, bmv[1:end])*
elapsed time: 0.066193955 seconds (25428088 bytes allocated)
*6100806*
As any can see I start with an array of 2^20 Uint64 : 8MB of zeros
and I go through it and modify a bit with some bit arithmetic.
What surprise me is the allocation more than 500MB to do a simple for loop
of a 8MB vector.
Actually the sum of pop-count across the same array only require an extra
24MB.
What am I doing wrong and do not understand about Julia?
(By the way I am not interested in other way to doing the same equivalent
processing (e.g. Bool array...) )
Thanks,
Eric.