Does any one know about optimization effects of passing in a variable via function arguments versus having the variable available via a closure? It seems like passing in variables via function arguments would be faster since objects are copied by reference (so fast copy time) and climbing the scope environments of the function requires checking the environment at each level. Here's the gist of what I mean
a = 5;
b = function() {
alert(a);
}
b();
versus
a = 5;
b = function(c) {
alert(c);
}
b(a);
Which in theory performs faster?