10-14-2022, 04:41 AM
FWIW I don't really think this is an optimization thing, unless Pete turned the "Compile program with C++ optimization flag" thing on then the code isn't being optimized. Beyond that, both the SCREEN() and ASC() functions live in a separate `.o` file from the main code so typically this means they would never be inlined since the linker doesn't normally do that (and we don't tell it to do link-time-optimization).
The one thing I was wondering is whether `h` was a SINGLE rather than integer value, then there would be a floating point conversion going on. Still, I would expect calling `func_screen()` to be slower than the floating point conversion.
The other consideration is whether the event checking around `h = SCREEN(j, k + i)` adds too much overhead, simply because `func_screen()` and `func_asc()` do almost nothing in these cases and thus should be very fast. If you have a chance you might try putting `$CHECKING:OFF` around it and see if the speed discrepancy is still there.
The one thing I was wondering is whether `h` was a SINGLE rather than integer value, then there would be a floating point conversion going on. Still, I would expect calling `func_screen()` to be slower than the floating point conversion.
The other consideration is whether the event checking around `h = SCREEN(j, k + i)` adds too much overhead, simply because `func_screen()` and `func_asc()` do almost nothing in these cases and thus should be very fast. If you have a chance you might try putting `$CHECKING:OFF` around it and see if the speed discrepancy is still there.

