, , , " ( , )".
, . :
f1(x) = x = zeros(size(x));
f2(x) = x[:] = zero(x[1]);
f3(x) = fill!(x, zero(x[1]));
f4(x) = x = zero(x);
:
julia> x=rand(1000,1000); @time (for i in 1_000_000_000; x=f1(x); end;)
0.000715 seconds (3 allocations: 7.629 MB)
julia> x=rand(1000,1000); @time (for i in 1_000_000_000; f2(x); end;)
0.000691 seconds (2 allocations: 32 bytes)
julia> x=rand(1000,1000); @time (for i in 1_000_000_000; f3(x); end;)
0.000702 seconds (2 allocations: 32 bytes)
julia> x=rand(1000,1000); @time (for i in 1_000_000_000; x=f4(x); end;)
0.000704 seconds (2 allocations: 7.629 MB)
PS. , , , , , " , " ...
,
f1 f4 ; , ; , , , -, OP.
, "" , , :)