Is there a penalty for calling millisecs()?

BlitzMax Forums/BlitzMax Beginners Area/Is there a penalty for calling millisecs()?

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.

Using a variable will always be faster then doing a function call, however, in some cases, it wouldn't be very useful.

GraphicsWidth() probably won't change on you, and if it does you can update the Variable at that time.

Millsecs() changes every... oh, every 1/1000 of a second :-)

So you will probably need to keep calling that function.

If the value changes A LOT then you're better off calling the function. If the value rarely changes but you access it a lot, then you should use a variable. If the value rarely changes and you rarely access it, then you could do either one.

If the value changes a lot, but you need to have a value from a given point in time, then you will need to do both. Call the function, save it in a variable then use the variable.

You have to look at every situation and make the determination of what is best for your situation.