Can you sport were I got lots of allocations? I donβt need a debugger, right now, I found the bug, this is just a motivating example, and I think a debug mode would be better than a debugger.
function time_code2(A)
code = encode_64_full((A[i], A[i+1], 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0))
for i in eachindex(A)[1:64:end]
decode_64_full(code)
end
end
julia> @time time_code2(A_orig2)
0.002365 seconds (10.00 k allocations: 5.189 MiB)
The loop count is 10000 (like the allocations). In case you donβt see it, hereβs the original (I was trying to simplify the loop to only time decode_64_full, moving encode_64_full out of it):
function time_code(A)
s = 0; for i in eachindex(A)[1:64:end]
decode_64_full(encode_64_full((A[i], A[i+1], 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0))) # A[i:i+63]
end
end
julia> @time time_code(A_orig2)
0.009769 seconds
Can you see it now:
function time_code3(A)
code = encode_64_full((A[1], A[1+1], 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0))
s = 0; for i in eachindex(A)[1:64:end]
decode_64_full(code)
end
end
julia> @time time_code3(A_orig2)
0.000026 seconds
I was staring at the code for a while.
The original title was βJulia without global variablesβ, then I changed my mind to βJulia without global variables, a debug modeβ. I didnβt want to give away where the bug is.