Yes, it seems the order can matter, at least when using SetDelayed (:=), which is common for functions. In that case, if you swapped the first two lines, it would indeed go faster.
One way to see this is with a very inefficient function, which calculates Fibonacci numbers the long way:
slowFib[n_] := If[n <= 2, 1, slowFib[n - 1] + slowFib[n - 2]];
On my machine, it takes about 3.2 seconds to calculate the 29th Fibonacci number this way:
slowFib[29] // AbsoluteTiming (* {3.23395, 514229} *)
Here is a slow calculation, with the same ordering as your example code. It takes 9.7 seconds to run the last line, because it is running slowFib 3 times to calculate y1:
y1 = slowFib1[29]; slowFib1 = slowFib; z1 = y1 + y1 + y1 // AbsoluteTiming (* {2.*10^-6, slowFib1[29]} {1.*10^-6, slowFib} {9.65774, 1542687} *)
Compare this to a "fast" version with the first 2 lines swapped. It calculates the value of slowFib[29] just once, when it assigns the value to y2, so it only does so once, and takes 3.3 seconds total:
slowFib2 = slowFib ) // AbsoluteTiming (y2 = slowFib2[29]) // AbsoluteTiming (z2 = y2 + y2 + y2) // AbsoluteTiming (* {1.*10^-6, slowFib} {3.28709, 514229} {4.*10^-6, 1542687} *)
What's going on here is that Mathematica only evaluates slowFib[29] when it is called. In the fast code (vesion 2), it gets called once when defining y2. In the slow code (version 1), it gets called thrice, when defining z1.
y=x^2, then later on, writex=10, thenynow automatically becomes100since it was pointing toxbefore, but nowxhas a value which is10. There is no explicit evaluation ofy. It is done automatically. It is all linked lists. If a symbolxhas value other than itself, then its value is used automatically when looking upy. $\endgroup$