It is well known that we use // Evaluate or Evaluated -> True to get Plot to "see" that it has received a list of functions and style each curve individually. However, in Version 11.0 this results in extreme slowdown for interpolating functions on finite element meshes.
<< NDSolve`FEM`
reg = Disk[];
mesh = ToElementMesh[reg];
eqs = {Laplacian[z[x, y], {x, y}] == 1, DirichletCondition[z[x, y] == 0, True]};
fun = NDSolveValue[eqs, z, Element[{x, y}, mesh]];
Do[ Plot[Table[fun[x/n, 0], {n, 4}], {x, 0, 1}], 100] // AbsoluteTiming
Do[ Plot[Table[fun[x/n, 0], {n, 4}] // Evaluate, {x, 0, 1}], 100] // AbsoluteTiming
Do[ Plot[Table[fun[x/n, 0], {n, 4}], {x, 0, 1}, Evaluated -> True], 100] // AbsoluteTiming
Surprisingly, the opposite occurs in Version 10.2 (i.e. the unevaluated version is slower):
Version 10.2 Version 11.0
(unevaluated) 73.6 (slow) 1.6
// Evaluate 11.8 53.9 (slow)
Evaluated -> True 11.6 53.5 (slow)
The time difference between unevaluated and evaluated does not appear in either version if we use polynomials or 1D interpolating functions, so this issue is specific to FEM interpolating functions.
What is causing slowness, why has it changed between versions, and how can I get fast plots in Version 11.0 with individually styled curves (apart from build a 1D interpolation or use ListPlot)?
RepeatedTiming):0.020,0.015, and0.014. – Henrik Schumacher May 15 '18 at 07:40