Hmm, which is faster?

BlitzMax Forums/BlitzMax Programming/Hmm, which is faster?

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

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.