I don’t understand why the setindex! involving b is slower than the non-contiguous setindex! involving a. If anything, I would have expected indexing b along columns to be as performant as indexing a along rows.
Interestingly the expected behavior is seen if the assignment is done through broadcasting:
You have it backwards: b[1,:] is non-contiguous, and a[:,1] is contiguous. Remember that Julia arrays are column-major.b[1,:] is indeed contiguous because b is an adjoint/transpose of a Matrix.
Might not be crazy to overload something to make this fast, maybe a method of _setindex!? #39467 did this for the corresponding views of transposed matrices, although times there were a factor 4, while I get about 4/3 for this example.