10-14-2022, 06:39 AM
(10-14-2022, 05:22 AM)Pete Wrote: Hi Matt,
I've already modified the code to the SELECT CASE snippet I posted, which solved the slow down the h = SCREEN() created. I do have a backup copy of the one with the speed killing situation. No, $CHECKING:OFF does nothing to offset the decreased speed issue in the backup copy with the speed reduction problem.
h, btw is an integer, defined by a DEFINT H-K at the top of the program.
Pete
Thanks for trying I'll have to give it some more thinking. Unfortunately on my machine just putting that logic into a loop (with some dummy types to make it compile) comes out with it running slightly faster if you store the value in `h` rather than use `SCREEN()` three times (as you originally assumed would be the case).
I'm not sure this is what you're doing, but I would note that the usage of `h` gets more expensive if it's in a `SUB` or `FUNCTION` and you're constantly calling it - there's some allocation overhead that goes on for `h` every time you enter the `SUB` or `FUNCTION` it is declared in. This is also a notable difference from `SELECT CASE`, as the internal variable that stores the value you're selecting on (to do the comparisons with each `CASE`) does not get allocated the same way and thus does not have that overhead. None of my testing on this can get close to a 5x slowdown thoughÂ