Mathematica doesn't want simplify the square root of the square even under assumptions

Suppose a simple function

f[x_,y_] = Sqrt[(x-y)^2]+Sqrt[(y-x)^2]

Knowing that $x>y>0$, without any commands like Simplify one can obtain (x-y) by using the Sqrt[(x-y)^2]-> (x-y) and Sqrt[(x-y)^2]-> (x-y):

f[s2, m2] /. {Sqrt[(x-y)^2] -> x-y,
Sqrt[(y-x)^2] -> x-y}

This might be used for the case of complicated functions involving many terms and other, when the Simplify command takes so much time. I tried to use it for one complicated function defined dynamically, but there was no result.

What is the reason and how to construct formal rule replacing the expressions like $\sqrt{(x-y)^2}$?

P.S. PowerExpand cripples the expression for the function...

• Perhaps you rejected PowerExpand because you used it without asumptions? For your example, PowerExpand[Sqrt[(x-y)^2] + Sqrt[(y-x)^2], Assumptions-> x>y] works well. – Carl Woll Aug 8 '17 at 17:20
• @CarlWoll : My complicated function after using the PowerExpand acquires some strange summands involving imarinary units and Args (even under assumptions) and expanding log[a/b] to log[a] - log[b], so I would like to avoid it. – John Taylor Aug 8 '17 at 17:22
• An example where PowerExpand is lacking would be useful – Carl Woll Aug 8 '17 at 17:27