Local variable vs. Global variable

Just wonder, if there any performance difference of using Local variable or Global variable in Q? Say there is a function, if there difference of performance of keep setting difference value to a global variable,  or return value to the caller?

Using globals are more expensive –

q)global:{a::42}
q)local:{b:42}
q)\ts do[10000000; global]
   1599 736
q)\ts do[10000000; local]
   1118 736

Also worth noting:

q)globalSet:{c set 42} q)\ts do[10000000; globalSet[]]    3474 736 q)globalApply:{@[.;`d;:;42]}
q)\ts do[10000000; globalAmend]
   3019 736

Mohammad Noor

Thanks