08-13-2022, 08:16 PM
Quote:Now, where you *do* see changes in performance is when loops are involved.
FOR I = 1 to 1000
SELECT CASE Foo
CASE 1 'do some stuff if foo is 1
CASE 2 'do some stuff if foo is 2
END SELECT
NEXT
Verses the following:
SELECT CASE foo
CASE 1
FOR I = 1 TO !000
'Do some stuff for when foo is 1
NEXT
CASE 2
FOR I = 1 TO !000
'Do some stuff for when foo is 2
NEXT
END SELECT
In this situation, the second set of code will perform better than the first set of code, even though it's more code to it!! WHY?? Because it's only making that SELECT CASE decision once, whereas the first set of code has to make that decision 1000 different times. Structure here can play a huge part on performance, and is something to keep in mind if your code is running noticeably slower than desired.
That's correct! For a farmer you know a hell of a lot about programming.
Have you ever thought of a book? Maybe with the other cracks here? - But not the umpteenth introduction and such, but just such special tips.