I couldn't find another question similar to this except this one: Storing Data in a Variable vs Inline Arithmetic
However that question was specific to Java, hence the micro memory management is really left to the JVM. My question relates to server-side JavaScript (ala NodeJs), and certain front-end frameworks like Ionic Framework.
Suppose we have some data and a function to utilize them.
var x;
var y;
var z;
var postRequest = function (x, y, z) {
// some logic.
}
Data x, y, z need to be parsed and audited before passing into postRequest.
Is there any performance-memory-related advantage in just parsing the data inline as the parameter? As such (pay no mind to the arithmetic) :
postRequest( (x % y) / (z * (y % z)) );
vs this
var x1 = (x % y);
var y1 = (y % z);
var y2 = z * y1;
var x2 = x1 / y2;
postRequest(x2);
The latter is definitely easier to maintain and clean up later if needed. But do we sacrifice anything memory wise? I'm talking on a mass server scale, in a hypothetical situation where the function is run in the requests of thousands of users. Can we save anything performance wise running inline rather than creating references?