I don't think performance will be an issue for this process because you can stop iterating the column of the array when the first non null element is found.
Also the process to compare is really quick matrix[i][j]!=null
, it doesn't take any complex processing.