It's probably quicker to use a local if it's just an int. Since it's likely that the memory around the stack will be in the processor cache more often than some data section area where a global resides.
(if it's an object and must be created I expect it will be quicker to have that as a global so it only needs to be instantiated once).
You can only be sure if you perform some timing tests however. The rule should be, write your code, if it needs a speed improvement, then profile it and target the problem areas - otherwise don't waste your effort.
(if it's an object and must be created I expect it will be quicker to have that as a global so it only needs to be instantiated once).
You can only be sure if you perform some timing tests however. The rule should be, write your code, if it needs a speed improvement, then profile it and target the problem areas - otherwise don't waste your effort.