From: | Curt Esser |
Date: | 10 Jan 2000 at 08:43:11 |
Subject: | Re: Strings and things |
Hi amorel
On 08-Jan-00, amorel wrote:
> Statements and functions are slow? Then how is it that people on this very
> list advice when optimising to get a loop as small as possible and put
> everything in statement, functions and subroutines?
>
> Should I just add everything in the main loop?
For greatest speed:
Avoid multiplys and divides as much as possible, especially in loops!
If a routine is only executed once, putting it right in the main loop is the
fastest.
If the routine is used more than once, in different places in the main loop,
make it a GOSUB - this is a little slower, but not very much.
And yes, functions and statements are much slower.
But they are much easier to use to transfer routines to another program,
because you don't need to worry about conflicts with variable names.
That is why you see routines posted on the list as functions so often.
And in many cases where speed is not critical, you will never notice any
difference.
But by all means try to avoid calling a function from inside a loop!
(I don't mean the main loop, rather one of those "For i = 0 to 100" kind)
Later...
Yours electronically,
Curt Esser
camge@amigaonline.net
http://members.xoom.com/Curt_Esser/
---------------------------------------------------------------------
To unsubscribe, e-mail: blitz-list-unsubscribe@netsoc.ucd.ie
For additional commands, e-mail: blitz-list-help@netsoc.ucd.ie