maximum – Using MaxValue to define a function, tracing is slow

I'm trying to compute the c functions (from the optimal transport theory), and so I have to calculate the supremes for a function $ f $ and the cost $ c $
$$ g (y) = sup_ {x in mathbb {R}} c (x, y) -f (x) $$

My code works but the plot is very slow.

c[x_,y_]: = - Log[Abs [x-y]+1]F[x_]: = By pieces[{{E^(-x^2)x>0}{E^((-x^2)/5)x[{{E^(-x^2)x>0}{E^((-x^2)/5)x[{{E^(-x^2)x>0}{E^((-x^2)/5)x[{{E^(-x^2)x>0}{E^((-x^2)/5)x<=0}}]
h[x_,y_]:=c[x,y]-f[x]
g[y_]:=MaxValue[h[x,y],x]
Plot[f[x],{x,-1,1},PlotLabel->"F"]Ground[g[y], {y, -1,1}, PlotLabel -> "f ^ c"]

How can I speed up tracing? I'm new to this 🙂