(f[a_?NumericQ] := NIntegrate[x Sin[a x], {x, 0, 10}];

Plot[f[a], {a, 0, 10}];) // AbsoluteTiming

(*

Out[66]= {10.193100, Null}

*)

(f2 = ParametricNDSolveValue[{D[y[x], x] == x Sin[a x], y[0] == 0}, y, {x, 0, 10}, a];

Plot[f2[a][10.], {a, 0, 10}];) // AbsoluteTiming

(*

Out[70]= {1.969538, Null}

*)

(fgood = NDSolveValue[{D[y[x, a], x] == x Sin[a x], y[0, a] == 0}, y, {x, 0, 10}, {a, 0, 10}, MaxStepSize -> Pi/20.];

Plot[fgood[10., a], {a, 0, 10}];) // AbsoluteTiming

(*

Out[67]= {0.058061, Null}

*)

(* Does not produce an accurate graph *)

(fbad = NDSolveValue[{D[y[x, a], x] == x Sin[a x], y[0, a] == 0},

y, {x, 0, 10}, {a, 0, 10}];

Plot[fbad[10., a], {a, 0, 10}];) // AbsoluteTiming

(*

Out[68]= {0.045235, Null}

*)

Since an integral is the solution to a differential equation, one can consider using NDSolve or ParametricNDSolve. NDSolve is over 100 times faster for this sort of use (e.g. plotting). This can be very important for certain uses, such as inside Manipulate. However NDSolve needed help on Sean Clarke's example.