I got one more: although it’s getting a bit ridiculous syntax wise ![]()
function fasterbaz3!(m)
nrows, ncols = size(m)
maximums = m[:, 1] # copying the first col saves one col in the first iteration haha
# iterate down the rows first which matches julia's memory layout
@inbounds for j in 2:ncols, i in 1:nrows
maximums[i] = max(maximums[i], m[i, j])
end
@inbounds for j in 1:ncols, i in 1:nrows
m[i, j] /= maximums[i]
end
end
@btime fasterbaz3!($m);
113.390 μs (1 allocation: 7.94 KiB)