I define a piecewise smooth function f(x), using a command such as Piecewise, Which, If, etc.
Than I define a new function g(x)=f(r(x)), where r(x) is a smooth function.
Then I get a function G(x) by integrating g(x) over x, using either NIntegrate or Integrate.
However this integration takes too much time. In particular, next integration of a function, which is defined using G(x), takes very much time.
How to make the integration of a piecewise smooth function faster in Mathematica?