It is very hard to make an algorithm more efficient than Matlab-build in codes. But you can use some straigth-forward linear algebra. If you are looking for the decomposition of A, such that A=Q*R you can modify this to A=Q*B*inv(B)*R for any matrix B. The new Q'=Q*B and the new R'=inv(B)*R conserving A=Q'*R' (no transposes or anything, just denoting new matrices).
Now by choosing B accordingly (probably diagonal) you can change the order of diag (R). Watch out that you keep Q' unitary if that is important in your case!