Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Paranoia
#4
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.  Rolleyes

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.
Reply


Messages In This Thread
Paranoia - by bartok - 08-13-2022, 03:47 PM
RE: Paranoia - by bplus - 08-13-2022, 04:51 PM
RE: Paranoia - by SMcNeill - 08-13-2022, 04:58 PM
RE: Paranoia - by bartok - 08-13-2022, 08:59 PM
RE: Paranoia - by Kernelpanic - 08-13-2022, 08:16 PM
RE: Paranoia - by Petr - 08-13-2022, 09:16 PM
RE: Paranoia - by bartok - 08-14-2022, 07:28 AM
RE: Paranoia - by TempodiBasic - 08-15-2022, 10:04 PM
RE: Paranoia - by bartok - 08-16-2022, 10:34 AM



Users browsing this thread: 1 Guest(s)