I get a @time
report:
92.505464 seconds (20.12 M allocations: 2.683 GiB, 0.29% gc time)
.
When I look at the code with --track-allocations=all
, the following (abbreviated) file is obtained.
All lines with any allocation whatsoever are included here. Clearly the number of allocations is
about 10, not 20 million. What is it talking about in the @time
report?
- function cs!(outputI, outputJ, outputV, I, J, V, Nc)
40240112 count = fill(zero(eltype(J)), Nc+1)
0 @inbounds for i in eachindex(J)
...
0 end
0 return nothing
- end
-
- function cp(Nc, J)
40240112 colptr = fill(0, Nc+1)
- p = 1
...
0 return colptr
- end
-
- function cr(N, colptr, I, V)
0 maxrows = maximum(diff(colptr))
- # newrows = fill(zero(eltype(I)), maxrows)
- # newvals = fill(zero(eltype(V)), maxrows)
336 prma = fill(zero(eltype(I)), maxrows)
458768240 newI = similar(I)
458768240 newV = similar(V)
40240112 newcolptr = similar(colptr)
0 newcolptr[1] = colptr[1]
...
0 end
458768048 newI = newI[1:p-1]
458768048 newV = newV[1:p-1]
0 return newcolptr, newI, newV
- end
-
- function sc(inputI, inputJ, inputV, Nr, Nc)
458768240 I = similar(inputI)
458768240 J = similar(inputJ)
458768240 V = similar(inputV)
-
...
- end
-