I read some threads about how the javascript function parameters passing works when the parameter is an object; I noticed that there is much confusion on the passing method, at least in the terminology: pass-by-reference, pass-by-copy-reference, and so on. This question is not about how is named this passing method, or how it works inside, but involves some way an answer to this question.
I have some large, very large object, to pass to a function as argument; I need to understand if the object-passing implies some copy of the object, so memory consumption, computational effort, memory leak risks are proportional to the size of the object passed, for each function call (I have many calls), or if it is passed in a non size-proportional consequences way.
Since altering the object's properties in the function alters the object in the outer scope, but altering the object itself does not, I think the memory used internally in the function to store and "reference" the parameter is not dependent on its size, because the object seems not to be copied, but I need to be sure about it.
Sorry for the poor explaining of my english!
EDIT: the answer involves in some way an insight on JS passing mode, but the core problem is performance improvement of practical case, so any theorical information is of good use, but the most important information needed is about computational and memory consumption.
Use case 1 (performance): Let's say I have a function that accesses two members of its argument, and writes some result on a third one, executed 1000 times on 1000 different object. The question is: the hypotetical cycle will take almost the same time if the object is made of the only 3 properties involved and if it has other hundred properties? Any difference would be caused only by parameter copy overhead or by selecting properties inside a larger object? Actual test could largely depend on browser, so I need technical, generic-valid answer to this.
Use case 2: I have 100MB object, passed to a function. During the execution time, do I have a memory occupation increase of 100MB? So any memory leak introduced, for example, by miscontrolled enclosures, are more dangerous.